2 回答

TA貢獻1942條經驗 獲得超3個贊
您顯然正在嘗試使用 repl.it 的“Python”來執行此操作,它不支持 tkinter 需要的顯示。他們確實提供了一個單獨的“Tkinter”選項,盡管它在語言列表中很遠。這是一個快捷方式:https ://repl.it/languages/tkinter
在那里你沒有得到那個錯誤。為了實際顯示窗口,您還必須在當前代碼下添加它:
root.mainloop()

TA貢獻1951條經驗 獲得超3個贊
from tkinter import *
top = Tk()
top.geometry("400x250")
#creating label
uname = Label(top, text = "Username").place(x = 30,y = 50)
#creating label
password = Label(top, text = "Password").place(x = 30, y = 90)
sbmitbtn = Button(top, text = "Submit",activebackground = "pink", activeforeground = "blue").place(x = 30, y = 120)
e1 = Entry(top,width = 20).place(x = 100, y = 50)
e2 = Entry(top, width = 20).place(x = 100, y = 90)
top.mainloop()
添加回答
舉報