Help with Tkinter!

flounder flounder_pounder at telebot.com
Sat Dec 4 17:54:34 EST 1999


This is whats going on I was playing around today and decided to learn
Python so I did. I have used TK before with both TCL and Perl so I am
also using it with Python and I have ran into a problem. The problem is
that I have a button that when clicked I want to pass a textvariable
from a Entry class to the function and print into stdout what is entered
into the text box at the time when the button is pushed  but when I
click the button it does not work. Here is an example of a simplified
version of what I want to do. Please Help :-(

#!/usr/bin/python

from Tkinter import *

i=""

def test(i):
    print i

mw = Tk()
mw.title("Python/TK")

Label(mw, text="This is written with Python/TK").pack(side=TOP)

Entry(mw, textvariable=i).pack(side=TOP)

Button(mw, text="TEST", command=test(i)).pack(side=TOP)

mw.mainloop()





More information about the Python-list mailing list