1

below an example of a Menu Bar in Tkinter:

from tkinter import *

parent = Tk()

parent.option_add("*tearOff", False)
MenuBar=Menu(parent)
parent.config(menu=MenuBar)

Edit=Menu(MenuBar)
Help=Menu(MenuBar)
MenuBar.add_cascade(menu=Edit, label="Edit")
MenuBar.add_cascade(menu=Help, label="Help")
Edit.add_command(label="Settings")
Help.add_command(label="License")
Help.add_separator()
Help.add_command(label="Documentation")
Help.add_command(label="About")

parent.mainloop()

In the "Help" menu there is a separator, but I don't like its style. I would very like to change it in another one (see the image below):

enter image description here

how can I replicate the separator style used in the second window on the right side?

  • As far as I know, you cant. Cause Tkinter uses the style of Windows/OS/Linux etc. Also while Menu isnt part of the ttk Modul there seems no way arround that. – Thingamabobs Jun 23 '20 at 17:39
  • 1
    Maybe you will take a look at this to inspire: https://stackoverflow.com/questions/60730049/a-customized-menu-bar-without-using-the-widget-tk-menu – Thingamabobs Jun 23 '20 at 17:47
  • You would need to use something like [`ttkthemes`](https://pypi.org/project/ttkthemes/), or maybe even [`ttk`](https://docs.python.org/3/library/tkinter.ttk.html). – 10 Rep Jun 23 '20 at 19:57

0 Answers0