473,804 Members | 3,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A question about event handlers with wxPython

I'd appreciate any pointer on a simple way to tell within an event handler
where the event came from.
I want to have "while" condition in a handler to stop or change processing
if an event occurs from some other button click.

Trying to bind more than one event to the same handler still doesn't tell me
where the event came from in a basic bind. Is there an argument I can put in
the bind so as to identify the source of the event in the event argument? .

Jan 15 '08 #1
7 1700
Hello Eric,
I'd appreciate any pointer on a simple way to tell within an event handler
where the event came from.
def HandleSomething (self, event):
generating_cont rol = event.GetEventO bject()
print generating_cont rol

HTH,
--
Miki Tebeka <mi*********@gm ail.com>
http://pythonwise.blogspot.com
Jan 15 '08 #2
def HandleSomething (self, event):
generating_cont rol = event.GetEventO bject()
print generating_cont rol

HTH,
Thank you.That is what I was looking for, but as often seems the case, one
thing exposes another. Is there any way to listen for events without
specifically binding to a handler (it seems one cannot bind an event to two
handlers?)? One could do so with globals, but I'm trying to avoid that.

For example, "press any button to stop"
def HandleSomething (self, event):
............... ..
while generating_cont rol: == something:
run
else
stop
Jan 15 '08 #3
On Jan 15, 9:04 am, "Erik Lind" <el...@spamcop. netwrote:
def HandleSomething (self, event):
generating_cont rol = event.GetEventO bject()
print generating_cont rol
HTH,

Thank you.That is what I was looking for, but as often seems the case, one
thing exposes another. Is there any way to listen for events without
specifically binding to a handler (it seems one cannot bind an event to two
handlers?)? One could do so with globals, but I'm trying to avoid that.

For example, "press any button to stop"

def HandleSomething (self, event):
............... ..
while generating_cont rol: == something:
run
else
stop
I forgot to provide a link to a fairly straight-forward explanation of
event propagation on the wxPython wiki: http://wiki.wxpython.org/EventPropagation

Hope that helps!

Mike
Jan 15 '08 #4
That all looks cool. I will experiment more. I'm a bit slow on this as only
two weeks old so far.

Thanks for the patience
Jan 15 '08 #5
On Jan 15, 2:20 pm, "Erik Lind" <el...@spamcop. netwrote:
That all looks cool. I will experiment more. I'm a bit slow on this as only
two weeks old so far.

Thanks for the patience
No problem. I'm pretty slow with some toolkits too...such as
SQLAlchemy. Ugh.

Mike
Jan 15 '08 #6

"Mike Driscoll" <ky******@gmail .comwrote in message
news:05******** *************** ***********@c4g 2000hsg.googleg roups.com...
On Jan 15, 2:20 pm, "Erik Lind" <el...@spamcop. netwrote:
>That all looks cool. I will experiment more. I'm a bit slow on this as
only
two weeks old so far.

Thanks for the patience

No problem. I'm pretty slow with some toolkits too...such as
SQLAlchemy. Ugh.

Mike
BTW,

The wxPython group that you mentioned....is that
http://wxforum.shadonet.com/ ?

Jan 16 '08 #7
On Jan 16, 12:45 pm, "Erik Lind" <el...@spamcop. netwrote:
"Mike Driscoll" <kyoso...@gmail .comwrote in message

news:05******** *************** ***********@c4g 2000hsg.googleg roups.com...
On Jan 15, 2:20 pm, "Erik Lind" <el...@spamcop. netwrote:
That all looks cool. I will experiment more. I'm a bit slow on this as
only
two weeks old so far.
Thanks for the patience
No problem. I'm pretty slow with some toolkits too...such as
SQLAlchemy. Ugh.
Mike

BTW,

The wxPython group that you mentioned....is thathttp://wxforum.shadone t.com/ ?
I think those are C++ users using the pure C++ wx. I meant the
following:

http://wxpython.org/maillist.php

Mike
Jan 16 '08 #8

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

Similar topics

3
2890
by: Robert | last post by:
Hello list, could somebody point me to a good reference about wxPython event handling? I have seen many examples but which one is the best. Waht are the advantages and disadvantages? Can you also have a short look at the example below and give me some comments, please? Example:
2
2769
by: Daniel Bickett | last post by:
Hello, I am writing an application using two event-driven libraries: wxPython, and twisted. The first problem I encountered in the program is the confliction between the two all-consuming methods of the two libraries: app.MainLoop, and reactor.run. Additionally, the fact that wxPython was to receive requests from the twisted framework as well as the end user seemed to be simply asking for trouble. My initial solution was, naturally,...
8
3131
by: Dennis C. Drumm | last post by:
I have a class derived from a SortedList called SystemList that contains a list of objects indexed with a string value. The definition of the objects contained in the SortedList have a boolean field and an event that is fired if the boolean field value changes. The derived SortedList class has an override for the Add method. The Add method adds an event handler for the object's event for each new item added to the list. In the...
6
1418
by: iclinux | last post by:
I have to build a GUI applicaiton that could run on different OS such as windows and *nix, which GUI toolkit is better? Best Regards.
16
2520
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some of properties or assign event handlers. I need to be able to clone the manipulated control at runtime. I could use the Clone method of some objects (like Font, Style, String,
14
8645
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event handlers are set like the old one. Is there a way to do this job? For example, is there a way to use EventInfo object to get all event handlers of the old control in runtime and set my new cloned control events to the event handlers of the old...
0
939
by: Tom Wright | last post by:
Hi all I'm writing my first wxPython app and am having a problem with event handlers. I've set up a multi-part status bar and would like all the tooltips, menu help strings etc. to go into the second part of it. Is there some easy way of doing this? I've not found one, so have set up the following for the menu: self.Bind(wx.EVT_MENU_HIGHLIGHT, self.OnMenuHighlight)
2
1578
by: dudds | last post by:
Hi I really haven't used wxPython before and I was just wondering if there was some sort of timer event that can be used. For example if I have a database that I want to query at regular intervals and display the results in a window is that possibly to do under a wx Python program? So far I have come across certain event handlers, but they all seem to wait for something to happen, like moving the mouse, clicking on a button etc. I just...
8
4280
by: Tony Johansson | last post by:
Hello! I wonder can somebody explain when is it suitable to use these methods OnKeyUp, OnKeyDown and OnKeyPress because these raise an event. These are located in class UserControl. If these raise an event how do I create an handler to catch these raised events. //Tony
0
9582
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3821
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.