我在網格中有一個按鈕,它已經有一個命令,它只列印文本。但是,我希望彈出一個按鈕以及文本。長話短說,我只是想在按鈕中添加一個按鈕。(基本上一個按鈕內的多個功能)這是我到目前為止所擁有的。
def myClick():
myLabel = Label(text="Hello " e.get() "... text ", bg='black')
myLabel.grid(row=60, column=0)
myButton = Button(window, bg='black', text="next", command=myClick)
myButton.grid(row=0, column=13)
uj5u.com熱心網友回復:
很高興再次回答您的問題。代碼中的注釋將解釋您可能會問的一些內容。
def myClick():
# clearing up the window
for widget in window.winfo_children():
widget.destroy()
# creating a new page
myLabel = Label(text="Hello " e.get() "... text ", bg='black')
myLabel.grid(row=60, column=0)
newButton = Button(window, bg='black', text="Some button you want to appear")
newButton.grid(row=60, column=13)
myButton = Button(window, bg='black', text="next", command=myClick)
myButton.grid(row=0, column=13)
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/523440.html
上一篇:if陳述句,TTK
