我希望看到Tkinter Entry的值。当我打字时,我看到打印'downkey';.如果我输入4个字符,那么我可以看到在窗口中的底部正确,好的,好的,好的等等。Python实时输入Tkinter
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()
什么是t他之间的空间'。虽然它在语法上是正确的,但它是丑陋的......但无论如何 - 你的问题到底是什么? –
@JonClements我打算开始修补答案,但我不知道你可以使用这样的点,所以也许我不是最好的人:) – RocketDonkey
@RocketDonkey是的,也:'1 .__ str__ '不是有效的属性访问,它是一个无效的浮点数,但是(1).__ str__'或'1。 __str__'将起作用...好醇'Python –