Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
FW: question Python custome events
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ian Kelly  
View profile  
 More options Oct 9 2012, 12:46 pm
Newsgroups: comp.lang.python
From: Ian Kelly <ian.g.ke...@gmail.com>
Date: Tue, 9 Oct 2012 10:45:31 -0600
Local: Tues, Oct 9 2012 12:45 pm
Subject: Re: FW: question Python custome events
On Tue, Oct 9, 2012 at 2:35 AM, Hussain, Mushabbar

Yes, you would need to:

1) encapsulate the variable;

2) define a custom event;

3) set up a wx.EvtHandler for the variable, since it's not itself
associated with a window;

4) bind your callback to the event handler;

5) have the variable setter fire the custom event.

That said, an event is likely not going to be the best way to do this.
 You should instead use the wx.lib.pubsub module, which implements the
observer pattern for you.  This will be cleaner and easier, as you
only need to:

1) encapsulate the variable;

2) subscribe your callback to the update message;

3) have the variable setter publish the update message.

Observers are also conceptually simpler than events.  You can find
information about pubsub at:

http://wiki.wxpython.org/WxLibPubSub

Cheers,
Ian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »