can't close frame via wx.EVT_CLOSE

Paul Hartley wrote:

If I click on the close ('X') at the top right of the frame, nothing happens. If I insert a print statement for debugging into on_close(), nothing is printed on screen. I have also tried binding the frame in the panel (frame.Bind(wx.EVT_CLOSE...). I also have tested closing using a button, but the button doesn't work either.

The code here is very similar to what is given in the wxPython frame demo, so I wonder if the problem may be related to opening a frame off a panel contained in a wx.Dialog, but that's just a guess!

I wouldn't expect that to cause a problem like this. What happens if you use None for the frame's parent? What platform and version are you using?

···

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

I wouldn’t expect that to cause a problem like this. What happens if you use None for the frame’s parent? What platform and version are you using?

the platform is wx 2.8.7.1, gtk unicode

Interesting thing happens if I use None for the frame’s parent. The frame will show up, but I still can’t close it. However, if I close the dialog, the frame will still be shown (obviously since it’s not bound to the dialog…), and now I can close the frame when I click on the ‘x’.

paul

Paul Hartley wrote:

    I wouldn't expect that to cause a problem like this. What happens
    if you use None for the frame's parent? What platform and version
    are you using?

the platform is wx 2.8.7.1 <http://2.8.7.1>, gtk unicode

Interesting thing happens if I use None for the frame's parent. The frame will show up, but I still can't close it. However, if I close the dialog, the frame will still be shown (obviously since it's not bound to the dialog...), and now I can close the frame when I click on the 'x'.

Ah, now that you've described it further I realize that this is something that I've seen before. Is it just the 'x' on the frame that doesn't work, or is the content of the frame not accessible either? IIRC there isn't anything that can be done about this, it's something to do with low level gtk behaviors. Could you make the first window be a frame instead of a dialog?

···

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

for what it’s worth, I had this frame (with None as parent) open right before the Dialog box opened, and I still could not close the frame until I closed the dialog box. My original approach was to have the dialog open, and then click on a button to open the frame (but I couldn’t close the frame).

My dialog window has a line trace plot on it. The reason I want to use a frame is so that a user can change attributes of the plot (i.e. color, line thickness) - it’d get crowded having all those options on the dialog window. Only other idea I have is to try using a frame instead of a Dialog for the plot - actually I would imagine that will work and is probably the solution… I was using dialog to keep the user from using the rest of the program while the plot was open.