[Tutor] Tk and Classes
alan.gauld@bt.com
alan.gauld@bt.com
Fri, 12 Apr 2002 10:53:58 +0100
> of the python tutorial simply to see how the data types and
> flow structures worked in python, and then from there
> I dove straight in to Tkinter by way of Fredrick Lundh(sp?)'s
> Tkinter guide.
There is a good point to be made here in that Tkinter
although class based does not need to use OOP to write a GUI.
So there is the alternative approach of using the Tkinter
classes but in a procedural style. This gives rise to lots
of limitations when you try to move to bigger projects
but is certainly doable in the short term.
The problem with learning OOP and Tkinter together is that
you are likely to learn some really bad habits on both
sides because they are both fairly complex subjects with
more than one way of doing it - mosty of them suboptimal!
But if you just need to throw a GUI together to do a job
and don't care about writing the same code over and over,
or creating your own widgets etc then you can more or
less ignore OOP and just do Tkinter.
> possible to learn how to manipulate classes and use Tkinter
Yes you can learn how to *manipulate* classes but much
harder to learn *about* classes as well as Tkinter.
Depends on how you define learning about classes I guess.
You can learn about how to manipulate classes from many
aspects of Python, including files, sequences, etc...
> the way I choose to learn python, my programs have gone
> through countless revisions as I have learned new tricks
> and better ways of doing the same thing. But I don't mind.
And thats the key. If you can afford to spend the time
rewritring/refactoring code as you progress then its a
valid approach. If you have to produce some production
strength code quickly a more merthodical approach is
probably better.
> thought it might help to see that there are many ways of
> teaching yourself what you need to know
A good point and worth making.
Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld