- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove dashed line from my tkinter menu UI?
The Menu widget in Tkinter is used to create Menu Bars in the navigation bar of an application. It is located at the top of the application window before the title bar. Sometimes, we see a dashed line which appear at the top of the first Menu Item. The tearoff(boolean) attribute in Menu specifies that if we start inserting the Menu item, then initially all the items get indexing from 1. However, when we turn off the tearoff property, the item can start its indexing from 0 and the dashed line will disappear from the top.
# Import the tkinter library from tkinter import * # Create an instance of tkinter frame win= Tk() # Set the size of the Tkinter window win.geometry("700x350") # Create an instance of MenuBar menubar= Menu(win) file= Menu(menubar, tearoff= 0) # Add Menu Items file.add_command(label= "New") file.add_command(label= "Open") file.add_command(label="Save") file.add_separator() file.add_command(label= "Quit") menubar.add_cascade(label="File", menu=file) win.config(menu=menubar) win.mainloop()
Running the above code will display a window with a Menu on the Navigation bar. When we click the Menu, it will display a list of Menu-items.
- How to remove the dashed line from the Tkinter menu UI?
- How to remove Ttk Notebook Tab Dashed Line? (tkinter)
- How to draw a dashed line on a Tkinter canvas?
- How to make dotted/dashed line in iOS?
- How can I remove dandruff from my hair?
- How to remove focus from a Tkinter widget?
- How to refer and import SAP-UI-Core.js within my SAPUI5 project
- Set dashed line for border with CSS
- How to create a Popup Menu in Tkinter?
- How to get alternating colours in a dashed line using Matplotlib?
- How to change the TKinter canvas line from dash to solid?
- How can I include dashed line for border with CSS
- How do I make a dotted/dashed line in Android?
- How to remove line numbers from data.table object in R?
- How can I create a dropdown menu from a List in Tkinter?