[wxPython] wxPython in emacs, must call Show(1);Show(0);Show(1)

I've begun playing with wxpython & pythoncard, and am quite impressed.

:slight_smile:

However, I've found a strange interaction between emacs python-mode interactive shells and wxPython's wxFrame.Show method.

In order to get any wxPython frame to display, if I'm running in a python-mode interactive shell I have to call frame.Show(1), then frame.Show(0), then frame.Show(1) again, and then the window will appear:

from wxPython.wx import *
app = wxPySimpleApp()
frame = wxFrame(None, -1, "Frame" )
frame.Show(1) # no frame appears
frame.Show(0)
frame.Show(1) # frame appears here
app.MainLoop()

Just calling Show(1) repeatedly doesn't help - and just calling Show(0);Show(1) doesn't help, either, it must be 1...0...1. In contrast, a single "Show(1)" works fine running from a bash shell inside windows, or running from emacs without an interactive python shell running, or in the same interactive shell, if I close the first frame then create a new frame.

Very strange.

Searching the mailing list showed someone else had experienced it (http://lists.wxwindows.org/pipermail/wxpython-users/2000-May/002165.html), but I couldn't find a mention of either the workaround I found, or a better solution.

FWIW, this is emacs 21.1.1, python-mode 3.104, NT 4, wxPython-2.3.2.1-Py22, Python 2.2.1, *whew* :slight_smile:

Any suggestions?

Thanks

kb

However, I've found a strange interaction between emacs python-mode
interactive shells and wxPython's wxFrame.Show method.

In order to get any wxPython frame to display, if I'm running in a
python-mode interactive shell I have to call frame.Show(1), then
frame.Show(0), then frame.Show(1) again, and then the window will appear:

This sounds like the same problem that Boa Constructor had with executing
wxPython apps via wxExecute. Basically (IIRC) the root of the problem is
that in order to get the stdout and etc. handles to the child process a
hidden console window is created. In the infinite shortsighted wisdom of
MS, they just set a flag that says "ignore the first Show." The reason you
need a show/hide/show is that wx thinks the window is already shown from the
first call and doesn't know that MSW ignored it.

BTW, I think the issue with wxExecute has been solved, so it should be
possible for emacs to do it too...

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!