I’m struggling to understand what’s going on with my wxpython application containing a py.shell in a panel and some wx.Timer instances.
Here’s the scenario:
I have a separate module containing a class which inherits from wx.Timer. Obviously, it must import wx otherwise wx is undefined when my module is imported.
I import my timer module into the py.shell and instantiate a timer to which I pass some local (to the shell) test function. This function just prints some messages does some counting and stops the timer, but the messages DON’T appear. Why? I know the timer is running and calling the function because on completion the counting has executed.
If on the other hand I import my module to my main wx then exactly the same test in the shell prints the messages, but to the terminal from which the application was started, not the shell.
The ultimate purpose of the timer module is a bit complicated, but essentially to manage binding to the passed in functions, doing some counting and finally unbinding.
Obviously the solution is to import to main, but I want to understand what’s going on. Again obviously, the indirect import of wx into the py.shell is a no no. So Two questions:
In the first case, where does the print output go?
In the second, why is the output going to the evoking terminal and not to the py.shell?
Actually 3 - what happens if the application is run without a terminal using #!/usr/bin/python
I’m running under Linux if that has any bearing. The module and test code is attached.
post.txt (1.77 KB)