Some basic questions about Tkinter (probably v easy for experts!)

Martyn Quick mrq at
Wed Feb 7 14:00:28 CET 2001

Apologies if this gets overly long - I'm feeling extremely frustrated in
my efforts to get to grips with Tkinter and want to get a good grip on
what I understand and what I am getting wrong.

(1) If I am going to use Pmw, then I need to have Tkinter installed.  But
do I need to understand how to use Tkinter (at least to a basic
degree) before I can use Pmw?

(2) Should a typical Tkinter program contain the following sort of lines:

from import Tkinter *
aardvark = Tk()

Am I right in thinking the last line is what produces the Tk window and
that without it nothing would happen?  Do I then just attach widgets the
aardvark object defined above and further widgets to these ones, etc.?
Alternatively, do I need to attach some sort of frame to aardvark first
before I can add buttons, menus, etc.?

(3) How do I run such a program?  Is the right way to open up a DOS box
(I'm using Windows 95) and type  python  at the prompt?

(4) Will the following correctly add a menu to my aardvark object?

from sys import exit
armadillo = Menu(aardvark)
armadillo.add_command(lable="Exit", command=exit)

If this isn't right - what is right, and more importantly *why* is it

Thanks in advance for your patience and wisdom...


Dr. Martyn Quick  (Research Fellow in Pure Mathematics)
University of Birmingham, Edgbaston, Birmingham, UK.

More information about the Python-list mailing list