Darius Poli wrote:
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.)
Any help greatly appreciated.
Here's a possible solution:
Convert your main panel to a wxDialog vs. a wxPanel or wxFrame,
then follow something like the following idiom:
app = wxPySimpleApp()
frame = wxFrame(None, -1, "Invisible Frame")
dlg = MyDialog(frame, -1, "My Dialog")
frame.Show(False) # don't show the parent frame
ret = dlg.ShowModal() # run the application, and get the return code
frame.Close() # Close the toplevel wxWindow, making the wxApp exit
app.MainLoop()
Regards,
/Will Sadkin
Parlance Corporation
www.nameconnector.com
Another possible solution is to add the line:
self.SetBackgroundColour(wxLIGHT_GREY)
right after your wxFrame.__init__ call.
David
ยทยทยท
-----Original Message-----
From: Will Sadkin [mailto:wsadkin@nameconnector.com]
Sent: Tuesday, May 13, 2003 11:30 AM
To: 'wxPython-users@lists.wxwindows.org'
Subject: RE: [wxPython-users] Problem closing a wxFrame from a button
Darius Poli wrote:
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.)
Any help greatly appreciated.
Here's a possible solution:
Convert your main panel to a wxDialog vs. a wxPanel or wxFrame,
then follow something like the following idiom:
app = wxPySimpleApp()
frame = wxFrame(None, -1, "Invisible Frame")
dlg = MyDialog(frame, -1, "My Dialog")
frame.Show(False) # don't show the parent frame
ret = dlg.ShowModal() # run the application, and get the return code
frame.Close() # Close the toplevel wxWindow, making the wxApp exit
app.MainLoop()
Regards,
/Will Sadkin
Parlance Corporation
www.nameconnector.com
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org