xrc: programmatic access to menu items

John Salerno johnjsal at gmail.com
Wed Nov 1 07:51:01 PST 2006


Robin Dunn wrote:

>> def UpdateUI(self, event):
>>     #what goes here? a bunch of if tests using each control?
> 
> No, just one.  You'll have one of these handlers for every item, and in 
> each you can do something like:
> 
>     event.Enable(not someCondition)

Oh, interesting. So when I write the Bind calls, I have to create a new 
handler for each one that is tied to the specified control, and in that 
handler I do the testing to enable/disable it?

That much makes sense, I think. I'll give it a try. But as far as 
actually calling Enable and Disable, I do this through the event 
parameter, not through a reference to the controls?

That seems a little odd, I guess because I don't have a good 
understanding of what 'event' really represents. I figured it had 
information about the event, but I didn't know you could use it to 
affect the object itself.




More information about the wxpython-users mailing list