我想实时查看 Tkinter Entry 值。当我打字时,我看到 print 'downkey';。如果我输入 4 个字符,我看到的一个条目位于窗口底部 ok、ok、ok、ok 等。
from email . mime . multipart import MIMEMultipart
from email . mime . text import MIMEText
from Tkinter import *
from ttk import *
import ConfigParser
import smtplib
class Example ( Frame ):
def __init__ ( self, parent ):
self . ini ()
Frame . __init__ ( self, parent )
self . parent = parent
self . initUI ()
def initUI ( self ):
self . parent . title ( "Quit button" )
self . style = Style ()
self . style . theme_use ( "default" )
self . pack ( fill = BOTH, expand = 1 )
inputfield = Entry ( self ) # I would like see this entry the app. window bottom in live, when i'm typewriter. If i key down/press call one function is class.
inputfield . place ( x = 10, y = 10 )
quitButton = Button ( self, text = "Quit", command = self . quit )
quitButton . place ( x = 50, y = 50 )
def main ():
root = Tk ()
root . geometry ( "250x150+300+300" )
app = Example ( root )
root . mainloop ()
if __name__ == '__main__':
main ()