Help with Tkinter!

Venkatesh Prasad Ranganath rvprasad at ksu.edu
Sun Dec 12 17:36:37 EST 1999


Hi,

Here is a chunk of code that does the same.  It's different due to some
limitations in Python/Tk.

      1 #!/usr/bin/python
      2 
      3 from Tkinter import *
      4 
      5 
      6 def test():
      7     print i.get()
      8 
      9 mw = Tk()
     10 mw.title("Python/TK")
     11 
     12 i=StringVar()
     13 Label(mw, text="This is written with Python/TK").pack(side=TOP)
     14 
     15 Entry(mw, textvariable=i).pack(side=TOP)
     16 
     17 Button(mw, text="TEST", command=test).pack(side=TOP)
     18 
     19 mw.mainloop()

It seems that i="" and textvariable=i doesnot work in python as it works
in Tcl.  The variable used in text variable should be a StringVar() or
the value of the variable when textvariable was assigned is considered
even if the value in the variable changes.

- Venkatesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rvprasad.vcf
Type: text/x-vcard
Size: 399 bytes
Desc: Card for Venkatesh Prasad Ranganath
URL: <http://mail.python.org/pipermail/python-list/attachments/19991212/9190849b/attachment.vcf>


More information about the Python-list mailing list