Another Question

Mike Driscoll kyosohma at gmail.com
Fri May 23 13:21:47 EDT 2008


On May 23, 12:02 pm, Gandalf <goldn... at gmail.com> wrote:
> On May 23, 6:25 pm, Mike Driscoll <kyoso... at gmail.com> wrote:
>
>
>
> > On May 23, 10:45 am, Gandalf <goldn... at gmail.com> wrote:
>
> > > How can i bind function that handle the mouse clicking  window X event
> > > or clicking alt+F4
>
> > > thanks
>
> > You really need to learn to ask good questions. Unless people dive
> > into your previous posts, they won't know what Python GUI toolkit you
> > are using, which version of said toolkit, which Python or which OS.
>
> > Here's a good place to read about events in general:
>
> >http://wiki.wxpython.org/EventPropagation
>
> > If you use Google, you can look for the close event, which gives you
> > this:
>
> >http://www.wxpython.org/docs/api/wx.CloseEvent-class.html
>
> > So you'll want to bind your frame to EVT_CLOSE. You can disable the
> > "X" in your frame's window by using non-standard style parameters.
>
> > Mike
>
> OK you right. I use WX on windows XP.
> I didn't understood how to use this wx.CloseEvent function.
>
> i really struggle with my poor english to understand this language, so
> your help is crucial for my progress and i appreciate it
>
> Thanks

No problem. It just makes it much harder to help if we don't know what
you're doing. I forget to mention stuff when I post too.

Just in case you still don't get it, here's some generic code:

<code>

self.frame.Bind(wx.EVT_CLOSE, self.onClose)

def onClose(self, event):
    self.frame.Destroy()

</code>

Note that I called the frame's Destroy() method instead of its Close()
method. If you call Close() then the EVT_CLOSE event gets fired again
and you basically end up in a loop.

Mike



More information about the Python-list mailing list