Strange behaviour of the button when calling askopenfilename(tkinter.filedialog) on click

27 Views Asked by At

here is the code:

from tkinter import *
from tkinter.filedialog import askopenfilename
root = Tk()
root.geometry('200x100')
def open_file (event):
    filename = askopenfilename()
btn_open = Button(None, text='Open')
btn_open.pack()
btn_open.bind('<Button-1>', open_file)
root.mainloop()

after button click and closing open file dialog the button remains 'pushed'. it is still alive and reacts on new clicks, but it remains stuck 'forever'. what should I change to fix this?

0

There are 0 best solutions below