Daniyal Warraich
Daniyal Warraich

Reputation: 456

How to set a background color and text color for a tkinter app completely?

I am trying to make a text editor in Python and Tkinter. The text editors function work well, but I want to add a dark mode for my app. After researching a bit, I can toggle the background color of the text input area and color of the text, but the background color of the top bar which has the 'save file' and 'open' and 'about' is not changing, and I do not know how to change it. Research doesn't help me.

import tkinter as tk

def dark_mode():
    # code #

root = tk.Tk()
root.title("Text Editor")

text = tk.Text(root)
text.pack()

menu = Menu(root)
# menu code here

root.mainloop()

I will provide a screenshot: enter image description here

The body of it, the text area, will become black, but the file menu/bar area will not. Any help?

Upvotes: 1

Views: 347

Answers (1)

Angelo
Angelo

Reputation: 94

You cannot change the color of the menubar on Windows or OSX. It might be possible on some window managers on linux, though I don't know for certain.

The reason is that the menubar is drawn using native widgets that aren't managed by tkinter, so you're limited to what the platform allows.

Source

Upvotes: 1

Related Questions