【发布时间】:2019-12-01 20:48:20
【问题描述】:
我有一个在按下按钮时出现和消失的框架。我希望框架在出现时具有动画效果,就像从按钮展开一样。
这是我目前的代码:
button_state = False #checks state of button
def click():
button_state ^= True #switches between True and False
if button_state == True:
frame.place(x=50, y=30, width=10, height=10)
else:
frame.place_forget() #makes frame disappear
frame = Frame(window, bg='lightblue')
button = Button(window, text="menu", command=click)
button.place(x=50, y=50, anchor=CENTER)
在 tkinter 中可以做这样的事情吗?
【问题讨论】:
标签: python python-3.x animation tkinter