[wxPython-users] Re: How to know what event IDs to use in menu?
E. A. Tacao
e.a.tacao at estadao.com.br
Mon Apr 23 17:33:19 PDT 2007
Monday, April 23, 2007, 2:23:19 PM, Grant Edwards wrote:
> I've whined about this before, but the idea of using global ID
> numbers to hook things together really grates on my sensibilities.
> It's painful to look at nice Python code where people pull a bunch
> of arbitrary integer values out of a hat in order to tell object A
> to call a method in object B when someting happens. You'd think the
> underlying library was written in Fortran IV instead of a
> purportedly object-oriented language like C++.
> Yes, I realize there are efforts to hide wxWidget's low-level
> ugliness from Python programmers. And yes, I realize it gives you
> the capabilities to do neat and powerful things that I've never
> needed to do and never will. I don't know what percentage of
> developers need those capabilities -- I just wish the rest of us
> didn't have to suffer because of it.
Maybe is just a matter of style, but I seldom use IDs at all. Whenever
I need to find an object, I use a 'self.object' reference or
event.GetEventObject(). If I _need_ an ID, I simply use wx.NewId() or I
derive the class in a way it won't require me to deal with IDs.
And as for menubars, if your app is going to require complex menus
and/or menubars, hopefully metamenus
<http://j.domaindlx.com/elements28/wxpython/Metamenus.html> will save
you a lot of time when coding your own menus.
-- tacao
No bits were harmed during the making of this e-mail.
More information about the wxpython-users
mailing list