[Tutor] To Class or not to class

Sharriff Aina nhytro-python@web.de
Tue, 16 Oct 2001 08:51:11 +0200


I=B4m writing a small GUI frontend for a dos app using Tkinter and Pmw, afte=
r much progress, I ran into problems originated from nested widgets, for e=
xample, my app instantiates a frame, this frame is the parent of a Noteboo=
k widget, this notebook widget holds a few GROUP widgets, these widgets ho=
ld in turn buttons, check boxes, entry fileds e.t.c, and it goes on and on=
. My problem is that after a while, some functions which I wrote just stop=
ped working. I know that it=B4s due to my "cut and pate" technique; I read a=
 tutorial that stated that it was good practise to encapsule all ones GUI =
apps in a class, so I decided to build on a simple application that demons=
trates this.


Back to my question, I think if I had written the app step by step in a li=
near fashion( using classes to build apps is newbie land for me) I would n=
ot have run into these problems. Could some state the advantages of using =
classes in building apps for me apart from the fact that one uses this met=
hod to separate GUI code from Buisiness logic=3F also is there  a simple gui=
ldline to follow, example; class methods first the the code for the constr=
uctor=3F
=20
=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de