Python Forum
[Tkinter] MenuBar hidden when new window opens
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] MenuBar hidden when new window opens
#1
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()
Yoriz write Sep-14-2022, 05:22 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
MenuBar hidden when new window opens - by john8888 - Sep-14-2022, 03:48 AM
RE: MenuBar hidden when new window opens - by Yoriz - Sep-14-2022, 05:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 644 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  [Tkinter] tkinter menubar not showing on mac ventura taras 1 2,134 Dec-17-2022, 02:44 PM
Last Post: Yoriz
  [Tkinter] GUI Opens Minimized gw1500se 24 6,074 May-05-2022, 04:12 PM
Last Post: deanhystad
  [Tkinter] Exclude hidden file, filedialog.askopenfile red380sl 1 3,206 Dec-01-2020, 07:04 PM
Last Post: DT2000
  [PyQt] Drag and Move window from menubar WBPYTHON 3 4,826 Apr-03-2020, 06:15 PM
Last Post: deanhystad
  tkinter window and turtle window error 1885 3 6,805 Nov-02-2019, 12:18 PM
Last Post: 1885
  update a variable in parent window after closing its toplevel window gray 5 9,186 Mar-20-2017, 10:35 PM
Last Post: Larz60+
  [Tkinter] Make A Button That Opens Another Tk() Window That I Have Made Saif133 5 28,389 Jan-20-2017, 08:10 PM
Last Post: scriptso

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020