0
我想知道原因以及如何解決問題?謝謝。爲什麼我輸入其中一個時,我的所有tkinter輸入小部件都會填滿?
import Tkinter
def next_screen():
input.place_forget()
search.place_forget()
account()
def account():
items = ["Username", "Password"]
details = Tkinter.LabelFrame(main, text = "Account Details")
details.pack(fill = "both", expand = "yes")
for item in items:
frame = Tkinter.Frame(details)
frame.pack(side = "top")
entry = Tkinter.Entry(frame, show = "*", textvariable = "StringVar")
entry.pack(side = "right")
label = Tkinter.Label(frame, text = item, padx = 15, pady = 15, width = 10)
label.pack(side = "left")
main = Tkinter.Tk()
main.title("Test")
main.geometry("400x300")
input = Tkinter.Button(main, text = "Input", command = next_screen)
search = Tkinter.Button(main, text = "Search")
input.place(height = 70, width = 90, x = "55", y = "105")
search.place(height = 70, width = 90, x = "255", y = "105")
main.mainloop()
我想了解tkinter並嘗試做出一些東西。使用這些代碼,我試圖在第一幀創建兩個按鈕,當輸入按下時,它會忘記當前的兩個按鈕,並顯示一個新的圖層,其中有兩個輸入小部件及其標籤。當我嘗試運行它並鍵入一個入口小部件時,所有入口小部件都被填充。