我可以制作一个功能正常但不可见的按钮吗?我查看了一堆 Tkinter 线程,但是当我测试代码时,它们都导致按钮完全消失并被禁用。这是我到目前为止所得到的:
import tkinter as tk
import time
app=tk.Tk()
app.minsize(500, 500)
#button function
def move():
button.config(state='disabled')
for i in range(50):
frame.place(x=250+i)
frame.update()
time.sleep(0.01)
frame.place(x=250, y=250)
button.config(state='normal')
block=tk.Frame(app, height=50, width=50, bg='red')
frame=tk.Frame(app, height=400, width=400, bg='blue')
#button I wish to be invisible
button=tk.Button(app, text='clickme', command=move)
button.place(x=40, y=40)
frame.place(x=250, y=250, anchor='center')
block.place(x=50, y=50)
app.mainloop()