Tkinter documentation?

Randall Hopper aa8vb at yahoo.com
Wed Dec 29 12:44:03 EST 1999


Gregory A McCoy:
 |    I am trying to locate any documentation on tkinter.

http://www.python.org/topics/tkinter/doc.html
http://www.pythonware.com/library.htm
http://www.pythonware.com/fredrik/tkdraft/


 |Specifically, how does one bind it to a python program?  I have a passing
 |familiarity with Tcl/Tk and expect that tkinter should behave just like
 |Tk.  They are, after all, the same thing aren't they?

The same GUI and interpreter under-the-hood, yes.  Different encapsulation
on top though which (IMO) makes Tk development more palettable in Python.

Not too sure what you mean about "binding" it to a Python program.  Are you
talking about accessing Tkinter in a Python script?  Or are you talking
about linking the Python interpreter with Tcl/Tk so you can use Tkinter?

If the former, in Tcl/Tk, you just start using Tk commands to create and
control Tk widgets:

   label .label -text "Hello World"
   pack .label

In Python, you do something similar, but with Tkinter's syntax.  You just
need to import the Tkinter definitions first:

   from Tkinter import *
   label = Label( text = "Hello World" )
   label.pack()

 |    I would appreciate any pointers to docs that I am missing.  Perhaps a
 |small demonstration program, eh???

Attached.

-- 
Randall Hopper
aa8vb at yahoo.com
-------------- next part --------------
#!/usr/bin/env python

from Tkinter import *

root = Tk()

w = Label( root, text="Hello, world!" )
w.pack()

root.mainloop()


More information about the Python-list mailing list