473,394 Members | 1,746 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,394 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 886
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.