-1
我正在嘗試創建一個GUI,使用Button小部件將顯示我輸入到Canvas()小部件的Entry()中的文本。任何想法,爲什麼這不工作?這是否需要小部件框架或類?
import Tkinter
master = Tkinter.Tk()
Canvass = Tkinter.Canvas(master)
Canvass.pack()
Entry = Tkinter.Entry(master)
Entry.pack()
def CreateText():
Canvass.create_text(100, 200, anchor="center", text=Entry.get())
Button = Tkinter.Button(text="Press Me",command=CreateText())
Button.pack()
master.mainloop()