At least I assume it's a simple problem. I had an app working well. It
called an instance of wxFrame which itself called an instance of wxPanel.
On the wxFrame, I had a menubar with an exit option (amongst others.) On
the wxPanel, I had a number of buttons that did things (created files as
output etc.)
I have now changed my app so that there is no menubar and I need to have a
button to close the wxFrame. This is because this app will now be called
from another app (non-Python) and so I want it to look like just another
dialog box. I can't seem to make a button on the wxPanel close the wxFrame
(seems sensible) so I moved everything into the wxFrame. While this now
works, it looks horrible as the background is a dark grey (and doesn't
really look like a dialog box, which was the point.)
I have attached simplified versions of the version 1 and version 2 code I am
using. Any help greatly appreciated.
At least I assume it's a simple problem. I had an app working well. It
called an instance of wxFrame which itself called an instance of wxPanel.
On the wxFrame, I had a menubar with an exit option (amongst others.) On
the wxPanel, I had a number of buttons that did things (created files as
output etc.)
I have now changed my app so that there is no menubar and I need to have a
button to close the wxFrame. This is because this app will now be called
from another app (non-Python) and so I want it to look like just another
dialog box. I can't seem to make a button on the wxPanel close the wxFrame
(seems sensible) so I moved everything into the wxFrame. While this now
works, it looks horrible as the background is a dark grey (and doesn't
really look like a dialog box, which was the point.)
Go ahead and use the panel, but make the event handler for the close button do something like this:
wxGetTopLevelParent(self).Close()
Or alternatively, just make the even thandler be a method of the frame class, and bind it to the frame with EVT_BUTTON, and then just do
self.Close()
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!