473,289 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Another Question

How can i bind function that handle the mouse clicking window X event
or clicking alt+F4
thanks
Jun 27 '08 #1
6 883
On May 23, 10:45*am, Gandalf <goldn...@gmail.comwrote:
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....ent-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
Jun 27 '08 #2
On May 23, 6:25 pm, Mike Driscoll <kyoso...@gmail.comwrote:
On May 23, 10:45 am, Gandalf <goldn...@gmail.comwrote:
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....ent-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
Jun 27 '08 #3
On May 23, 12:02*pm, Gandalf <goldn...@gmail.comwrote:
On May 23, 6:25 pm, Mike Driscoll <kyoso...@gmail.comwrote:
On May 23, 10:45 am, Gandalf <goldn...@gmail.comwrote:
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....ent-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
Jun 27 '08 #4
you've been very helpful but still i have only one problem. I wont the
window not to be close after clicking the X button.
I wont the program to stay on the toolbar

thanks!
Jun 27 '08 #5
On May 23, 1:44*pm, Gandalf <goldn...@gmail.comwrote:
you've been very helpful but still i have only one problem. I wont the
window not to be close after clicking the X button.
I wont the program to stay on the toolbar

thanks!
Well then, in your event handler, just don't do anything.

def onClose(self, event):
pass

or maybe you want to hide the frame?

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

Just make sure you give the user some other way to close it and in
that handler, you'll need to call self.frame.Destroy().

Alternatively, you can just tell the frame not to create the "X"
button:

self.frame = wx.Frame(None, -1, title="My Frame",
style=wx.SYSTEM_MENU)

However, that makes it pretty annoying to close.

Mike
Jun 27 '08 #6
On May 23, 10:47 pm, Mike Driscoll <kyoso...@gmail.comwrote:
On May 23, 1:44 pm, Gandalf <goldn...@gmail.comwrote:
you've been very helpful but still i have only one problem. I wont the
window not to be close after clicking the X button.
I wont the program to stay on the toolbar
thanks!

Well then, in your event handler, just don't do anything.

def onClose(self, event):
pass

or maybe you want to hide the frame?

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

Just make sure you give the user some other way to close it and in
that handler, you'll need to call self.frame.Destroy().

Alternatively, you can just tell the frame not to create the "X"
button:

self.frame = wx.Frame(None, -1, title="My Frame",
style=wx.SYSTEM_MENU)

However, that makes it pretty annoying to close.

Mike
OK the first method still didn't work. no matter what i do the window
keep closing but the last one worked nice and all the top menu
disappear

thanks!
Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
6
by: anon | last post by:
Post Forwarding question...... For this control below, <asp:Button runat="server" PostTargetUrl="page2.aspx" /> The Attribute: PostTargetUrl="page2.aspx" Is this PostTargetUrl Attribute...
2
by: terence.parker | last post by:
I am often faced with the dilemma of whether to use a JOIN query across three tables in order to grab a bunch of results - or whether to create another table to represent what I want. The latter is...
0
by: Sebastian Hiller | last post by:
Hello, i'm new to .Net (i'm using VB as language and i'm working in the code-behind mode) and i can't solve the following problem: I have a WebForm and want to Add a UserControl...
3
by: Brad | last post by:
I have another hopefully simple question. I am so used to writing VB .Net windows apps that there are some things in ASP .Net that just does not easily cross over. I know how to pass variables to...
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
24
by: David Mathog | last post by:
On a Solaris 8 system if a user "joe" logs in, for instance via ssh, cuserid() returns "joe". That's the expected behavior and so far so good. However if that user then does: % su - sally ...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
4
by: MichaelK | last post by:
Hello. I have all data already collected on the current page? I want to open another window with the form, fill the fields and submit that form. So basically the question is how can I fill all...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.