When I open a filedialog with a menu button, the menu is disabled afterward, and I can't do anything with it.
How can I make the menu not disabled after the button click?
Info
- Python: 3.8.3
- OS: Mac MoJave 10.14.6
- TkInter: 8.5
Here's some sample code to reproduce.
Click File
-> Load
-> Cancel
import tkinter as tk
from tkinter import filedialog
def load_file():
filename = filedialog.askopenfilename()
def main():
root = tk.Tk()
root.title('Open File')
menubar = tk.Menu(root)
root['menu'] = menubar
menu_file = tk.Menu(menubar)
menu_file.add_command(label='Load', command=load_file)
menubar.add_cascade(menu=menu_file, label='File')
root.mainloop()
if __name__ == '__main__':
main()