Some basic questions about Tkinter (probably v easy for experts!)
Martyn Quick
mrq at for.mat.bham.ac.uk
Thu Feb 8 05:28:23 EST 2001
On 7 Feb 2001, Neil Cerutti wrote:
> >As I said in my reply to Fredrik Lundh's answer, I did *try* to
> >read this, but unfortunately I found it rather difficult. It
> >doesn't actually seem to be aimed at beginners who are new to
> >Object Oriented Programming.
>
> Oh! That'll make it difficult to follow. Sorry. Using Tkinter
> isn't a good way to learn OOP.
>
> Luckily, the semantics and syntax of OOP is easy to learn
> in Python, if not the practice.
I *think* I'm beginning to get the idea of OOP - it just doesn't come as
second nature yet. Thanks very much for your example below - I have one
question about it (apologies!) but I've managed to make a start on writing
the code I want. My own code isn't very OOP yet - but I've put lots of
comments in to remind me to adjust it when I've got a better idea of what
will make sensible classes, etc.
> Here's a small demo. I'm not going to use "import *" here, to
> hopefully make it a little clearer. You don't need to type in the
> comments. ;-)
>
> [snip example]
>
> # The window won't appear and your other widgets won't function
> # until:
> root.mainloop()
OK, I followed that example and it was very helpful - *however* I think I
am misunderstanding your final comment here. When I typed the example
into python running in a DOSbox window, the window & button did appear and
did do what they were supposed to before I used root.mainloop(). This
seems contrary to what you've written above. (Perhaps when I run the
thing as a script I need the mainloop() but less so when it's done at
command prompt??).
Once more, thank you very much for your answer Neil, I found it extremely
helpful.
Martyn
--------------------------------------------------------
Dr. Martyn Quick (Research Fellow in Pure Mathematics)
University of Birmingham, Edgbaston, Birmingham, UK.
http://www.mat.bham.ac.uk/M.R.Quick
More information about the Python-list
mailing list