G
Grant Edwards
I've decided to learn wxPython, and I'm afraid I just don't
grok the whole "id" thing where you have to pull unique
integers out of your, er, the air and then use those to refer
to objects:
From whe wxPython wiki examples:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325))
EVT_BUTTON(self, 10, self.OnClick)
Does the 10 have any function other than as a handle that
allows you to refer to self.button in the EVT* call?
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?
This feels very assmebly-level. No, it's even worse than
assembly language, since even assembly language has labels and
symbols.
Why not this:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325))
EVT_BUTTON(self, self.button, self.OnClick)
Or better yet this:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325), action=self.OnClick)
This last way seems pretty intuitive...
Can somebody clue me in on the advantages of the
progrmmer-generated integer id numbers for objects?
grok the whole "id" thing where you have to pull unique
integers out of your, er, the air and then use those to refer
to objects:
From whe wxPython wiki examples:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325))
EVT_BUTTON(self, 10, self.OnClick)
Does the 10 have any function other than as a handle that
allows you to refer to self.button in the EVT* call?
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?
This feels very assmebly-level. No, it's even worse than
assembly language, since even assembly language has labels and
symbols.
Why not this:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325))
EVT_BUTTON(self, self.button, self.OnClick)
Or better yet this:
self.button =wxButton(self, 10, "Save", wxPoint(200, 325), action=self.OnClick)
This last way seems pretty intuitive...
Can somebody clue me in on the advantages of the
progrmmer-generated integer id numbers for objects?