簡體   English   中英

按鈕隱藏/顯示

[英]Button hide/show

我目前正在嘗試創建一個可以隱藏或顯示定義(def)的按鈕。

root.Tk()
c = Canvas(root, wodth=1600, Height=100, bg='black')
root.attributes('-fullscreen', True)
c.pack
b = Button(c, text='I want to by unvisiblie')
b.place(x=210, y=88)

root.after(1)

請問你能幫幫我嗎? 我該怎么做(請不要自行命令)? 謝謝

所以...您可以使用“place_forget”隱藏任何小部件..

所以這是可以幫助你的!

from tkinter import *
root = Tk()
a_button = Button(c, text='I want to by unvisiblie', command = lambda:b.place_forget())# I think the text should be "I want to be invisible!"
a_button.place(x=210, y=88)
root.mainloop()

我希望你想要這個答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM