wxPython/wxWidgets: Debug Console, code modifying (stort of "real time" REPL)
Hello again,
using a scripting language like Python for getting started with an complex GUI framework such as wxPython/wxWidgets has many advantages. The main one is that code snippets could be executed during debugging.
I tried this with the PyCharm debug console.
PyCharm 2016.3 Help :: Using Debug Console
https://www.jetbrains.com/help/pycharm/2016.3/using-debug-console.html
But all the steps are time-consuming and I want to knowe whether there is a better way (maybe an plugin?):
1. Open the Debug Command Line, menu Tools -> Open Debug Command Line
2. Pause Program
3. Click somewhere on the GUI
4. In my case there is (luckily) an event OnUpdateUI, execution stops
5. Now the Debug Command Line is ready for input
6. Input code snippet(s)
7. Resume Program [F9] to see changes in the GUI itself
And then...
...repeating from step 2...
Any hints/ideas are highly appreciated!
Many thanks and greetings
StormFennec
Please sign in to leave a comment.
Hi! There are more opportunities:
1. This one works for PyCharm 2017.1. After stopping at a breakpoint, you can select code to execute and run action "Execute Selection in Console". After that debug console will be opened automatically and code will be executed there.
2. You can set Evaluate expression for your breakpoint (Run | View Breakpoints -> select your breakpoint -> check the option "Evaluate and log")
Hello Elizabeth,
thanks for your answer. My main problem is I must repeat all the mentioned steps after my code snippet is executed. I'm looking for an more convenient way. There should be an option that the process pauses automatically when I type something in the Python console - without the need to additionally clicking on the GUI to get the input prompt >>> (2-5). With [F9] the program resumes (btw, for Pause Program no shortcut is defined, main menu Run -> Pause Program) (7).
From my point of view a perfect solution is quite complex, but it would be worth all the efforts. Maybe injecting code in MainLoop() is an approach. I would like to discuss that topic with one of your developers.
Many thanks and greetings
StormFennec
You can go to Settings | Keymap -> type "Pause program" in the search window and use "Add Keyboard Shortcut" action.
If it isn't enough, feel free to create a feature request in our issue tracker: https://youtrack.jetbrains.com/issues/PY