wx.Frame hidden, and customising the close button

Vlastimil Brom vlastimil.brom at gmail.com
Fri Feb 11 14:39:24 CET 2011


2011/2/11 Mark Carter <alt.mcarter at gmail.com>:
> Is there a way of testing whether a frame (suppose I have it as a
> variable my_frame) is hidden in wxPython?
>
> Also, is there a way that I can over-ride the close button so that the
> frame becomes hidden rather than destroyed, and perform supplementary
> tests?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Hi,
For testing whether the frame is shown, you can simply use frm.IsShown()
>>> my_frame.IsShown()
True
>>>

[here shown with a shell connected to that frame]

To intercept closing the window using a clicks on the "x icon" catch
the respective event
wx.EVT_CLOSE

Check the sample e.g. in
http://wiki.wxpython.org/wxPython%20by%20Example
"Adding an Event Handler"

(wxPython-specific questions may be rather discussed  on that maillist:
http://groups.google.com/group/wxpython-users/topics?pli=1

wxpython-users at googlegroups.com )

hth,
  vbr



More information about the Python-list mailing list