-1

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()

stovfl
  • 14,998
  • 7
  • 24
  • 51
Vafilor
  • 75
  • 1
  • 1
  • 9

1 Answers1

1

[edit] It looks like this happens after I close and reopen my mac - putting it on standby. Restarting the mac completely fixes the issue.


Not sure what's going on, but I can no longer reproduce this. I guess the answer was reboot your machine?

Vafilor
  • 75
  • 1
  • 1
  • 9