Beginning to learn python...help needed!
Robert L Hicks
bobhicks at adelphia.net
Mon Feb 5 11:51:13 EST 2001
"Python an Tkinter Programming" by John Grayson is an excellent work and has
great info on Tkinter as well as PMW.
I think Mark Lutz is coming out with an update to his tome around March or
Hmmm...I would use a class when I have a collection of objects with
def __init__(self, aString):
self.text = aString
Having defined a class you can now create instances of the Message class and
m1 = Message("Hello world!")
m2 = Message("So long and thanks for all the fish!")
note = [m1, m2) # put the objects in a list
for msg in note:
msg.printIt() # print each message in turn
Hope this helps. The example was taken from "Learning to Program using
Python" by A. Gauld. He also has a web site at:
I have found both to be extremely useful!
> From: Martyn Quick <mrq at for.mat.bham.ac.uk>
> Organization: The University of Birmingham news server
> Newsgroups: comp.lang.python
> Date: Mon, 5 Feb 2001 15:35:27 +0000
> Subject: Beginning to learn python...help needed!
> I'm just beginning to learn Python. I've done a little programming before
> (so I'm quite happy with manipulating lists and using for/while loops,
> etc.), but I'm having trouble understanding the "Object Oriented" part of
> the programming. Can anyone give some advice when is the right time to
> use a class, as opposed to just using the def command?
> I'm also getting nowhere with Tkinter. I tried to look at the Tkinter
> tutorial which can be downloaded from python.org, but found that it went
> far to fast without nearly enough explanation. I've seen that wxPython is
> an alternative, but someone said that there was less documentation
> available for that. Given what I've found with the documentation for
> Tkinter, this comment puts me off slightly. Can anyone point me in the
> direction of detailed info on an appropriate GUI? (Am I right in thinking
> that the reason I'm having trouble with Tkinter is that the Object
> Orientedness is more apparent early on?)
> Apologies for writing a rather long and rambly message!
> P.S. I cannot afford to buy a book on the subject - I'm a rather junior
> academic in the UK and don't get paid very highly!!!
> Dr. Martyn Quick (Research Fellow in Pure Mathematics)
> University of Birmingham, Edgbaston, Birmingham, UK.
More information about the Python-list