Open In App
Related Articles

Changing the colour of Tkinter Menu Bar

Improve Article
Save Article
Like Article

Prerequisites: Tkinter

Menus are an important part of any GUI. A common use of menus is to provide convenient access to various operations such as saving or opening a file, quitting a program, or manipulating data. Toplevel menus are displayed just under the title bar of the root or any other toplevel windows. 

Changing the color of menubar is not available on the Windows. This is because the menubar is not owned by Tkinter itself, but it is outsourced from other third-parties, hence providing the users limited options only. But if are using Linux, then you are all set to go. You can change the color of menubar by setting the background color and foreground color. Just read the article given below to know more in detail.


menubar = Menu(app, background=’#background color’, fg=’#text color’)

Here, the color to be added to the menubar is given as input to the background parameter. Given below is the proper example to do the same.



# Import the library tkinter
from tkinter import *
# Create a GUI app
app = Tk()
# Set the title and geometry to your app
app.title("Geeks For Geeks")
# Create menubar by setting the color
menubar = Menu(app, background='blue', fg='white')
# Declare file and edit for showing in menubar
file = Menu(menubar, tearoff=False, background='yellow')
edit = Menu(menubar, tearoff=False, background='pink')
# Add commands in in file menu
file.add_command(label="Exit", command=app.quit)
# Add commands in edit menu
# Display the file and edit declared in previous step
menubar.add_cascade(label="File", menu=file)
menubar.add_cascade(label="Edit", menu=edit)
# Displaying of menubar in the app
# Make infinite loop for displaying app on screen


change menu color

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 07 Apr, 2021
Like Article
Save Article
Similar Reads
Complete Tutorials