How to remove dashed line from my menu UI?

The best way to remove the dashed line is to use the option_add method to set the *tearOff option of root to False before you start creating any menus. Here you can do this in your initUI method like this:

def initUI(self):
     self.master.title("test")
     self.master.option_add('*tearOff', False)

This will remove the dashed line for each menus you will create so won't need to set the tearoff=False anytime you create a menus.


Just add this line before root.mainloop():

root.option_add('*tearOff',FALSE)

It worked for me, I am using Python 3.7.0


Set tearoff option of fileMenu to False (or 0)

fileMenu = Menu(menubar, tearoff=False)

Tags:

Python

Tkinter