Don't understand wxPython ids
Matt Brubeck
mbrubeck at cs.hmc.edu
Thu Apr 29 17:10:58 EDT 2004
Grant Edwards <grante at visi.com> wrote in message news:<408ed938$0$17263$a1866201 at newsreader.visi.com>...
> You're supposed to just make up unique id numbers for objects
> when a) they've already got unique id numbers [at least the id
> builtin thinks so] and b) they've got names that make things
> even more readable?
"Wax" is a wxPython wrapper under development at:
http://zephyrfalcon.org/labs/
http://zephyrfalcon.org/weblog/arch_Wax.html
Wax has a much more Pythonic API than wxPython, and gets rid of the
numeric IDs completely. For example:
b = Button(parent, "Save", onsave)
Alternately:
b = Button(parent, "Save")
# ...
b.OnClick = onsave
Here's a longer snippet from the Wax primer:
def CreateMenu(self):
menubar = MenuBar()
menu1 = Menu(self)
menu1.Append("&New", self.New, "Create a new file")
menu1.Append("&Open", self.Open, "Open a file")
menu1.Append("&Save", self.Save, "Save a file")
menubar.Append(menu1, "&File")
self.SetMenuBar(menubar)
More information about the Python-list
mailing list