The old post was using an old syntax - note that it says
wxFrame not wx.Frame. You want to say:
self.Bind(wx.EVT_CLOSE, self.OnClose)
···
At 09:13 AM 8/12/2008, you wrote:
I'm trying to select all of the content in a textbox when the user 'Alt+Tab's to the program, and I'm having trouble defining the event. I ran across an old post to this list and someone posted code to catch a close window event from the frame. Specifically, the beginning of the frame definition looked like:
def __init__(self):
wxFrame.__init__(self, None, -1, "A Frame")
EVT_CLOSE(self, self.OnClose)I want to do something similar, except on a different event. However, I can't really experiment to find what event I want to catch because it crashes my program. Here's the pertinent part of my code:
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(600, 700))
EVT_CLOSE(self, self.OnActivate)The error that I get says, "NameError: global name 'EVT_CLOSE' is not defined. self.EVT_CLOSE doesn't seem to work, either. Anyone have any ideas?
As a side note, when this error happens a window flashes up with the error far too quickly for me to read. I have resorted to taking a printscreen of the window, but this is tedious because it's fast enough so as to be hard to catch. Is there a way to make that window stay around longer? I'm working in SciTE.
Thanks!