![]() |
[Tkinter] MenuBar hidden when new window opens - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] MenuBar hidden when new window opens (/thread-38191.html) |
MenuBar hidden when new window opens - john8888 - Sep-14-2022 Got my first menu working based on this code from the web. Problem is the menu commands disappear when a menu item is selected. Is there some way to keep it visible? Thanks from tkinter import * def donothing(): filewin = Toplevel(root) button = Button(filewin, text="Do nothing button") button.pack() root = Tk() menubar = Menu(root) filemenu = Menu(menubar, tearoff=0) filemenu.add_command(label="New", command=donothing) filemenu.add_command(label="Open", command=donothing) menubar.add_cascade(label="File", menu=filemenu) root.config(menu=menubar) root.mainloop() RE: MenuBar hidden when new window opens - Yoriz - Sep-14-2022 See Namespace flooding with * imports I tried the code, I don't know what you mean by the menu commands disappearing when a menu item is selected as I was able to reuse the menu and select another menu item. RE: MenuBar hidden when new window opens - deanhystad - Sep-14-2022 What do you mean by "Is there some way to keep it visible?" When I run your code the new windows partially occlude the menubar. Do you want the new windows to be drawn somewhere else so the main window remains completely visible? Or are you asking if there is a way to keep the file menu open so you don't have to click on the file menu each time to see the options? RE: MenuBar hidden when new window opens - john8888 - Sep-14-2022 Clicking "File" shows New/Open: [attachment=1986] Then clicking Open opens a small panel but hides the New/Open [attachment=1987] Yes, the list can be reopened by clicking on File again but it would be nice if this list stayed open. If that's the way tkinter works that's fine but I thought I might be missing something. Thanks, and sorry about the formatting. RE: MenuBar hidden when new window opens - deanhystad - Sep-14-2022 That is the way all menus work. If you want it to work differenly use a different control. Maybe some buttons? RE: MenuBar hidden when new window opens - john8888 - Sep-14-2022 Thanks, that's fine now I know how it works |