[wxPython-users] Re: Newbie question about events and event
handling
Robin Dunn
robin at alldunn.com
Fri Nov 2 14:51:52 PDT 2007
Patrick J. Anderson wrote:
> On Thu, 01 Nov 2007 16:42:13 -0700, Christopher Barker wrote:
>
>> Patrick J. Anderson wrote:
>>> I'm not sure how DayPlanner instance can catch the event originating in
>>> from MiniCalendar instance and change the UI to reflect it.
>> You have two options:
>>
>> 1) put a reference to the DayPlanner instance in your MiniCalendar, then
>> call a method on it in your event handler. That's the easiest way,
>> though maybe better to use the main frame or App object as an
>> intermediary.
>>
>> 2) Use a way to post an event indicating that the date has changed. You
>> can either use custom wx event and wx.PostEvent to do that, or, even
>> better, use a system like wx.lib.pubsub to pass events around your app.
>> I think that's probably what you want.
>>
>> -CHB
>
> I used the reference to DayPlanner (option1) in my MiniCalendar and I
> call a method setDate() on planner instance, but how do I update the
> widget, so it reflects the change?
What kind of widget is it? How did you give it the initial value?
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list