[Tutor] wxPython newbie

Magnus Lycka magnus@thinkware.se
Wed Jan 8 16:03:01 2003


At 16:41 2003-01-08 +0000, alan.gauld@bt.com wrote:
>When in doubt print it out is my motto.

And my motto is "When in doubt, learn the right way
to do it!" ;)

>Why not just add  a couple of lines:
>
>         res = d.ShowModal()
>         print res

Because it will just be a stupid digit that doesn't
mean anything to whoever reads the code. Magic numbers
in the code is a no-no in my book. Who can be certain
that these constants will remain the same in the next
version of wxPython? (If I was wxWindows maintainer I
might just shuffle them around on purpose between
versions just to break such badly written code! ;)

>See what gets printed and substitute in your program...

Better to use wxID_YES, wxID_NO, wxID_OK or wxID_CANCEL.


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se