gwthm.in
gwthm.in

Reputation: 638

How to change the colour of menu in Tkinter under windows?

I'm using windows xp. I want to change menubar and labels foreground and background in TKinter. But, I'm unable to change. Can I change it in windows xp or I have to upgrade it to windows 7.

from Tkinter import *
root = Tk()

menubar = Menu(root)
menubar.add_command(label = 'Label1', command = log, background = 'Black', foreground = 'Red')

root.config(menu=menubar)
root.mainloop()

I'm able to display what I want and my code is working perfectly in Linux. But, it's not changing the color in window. Do I need to use any additional commands to make it work?

Upvotes: 1

Views: 3160

Answers (2)

Varada
Varada

Reputation: 1055

from Tkinter import *
def log():
        print 'in log fun'

root = Tk()

menubar = Menu(root)
menubar.add_command(label = 'Label1', command = log)

root.config(bg='red',menu=menubar)

root.mainloop()

you can config the background color, not possible to menu background color. enter image description here

Upvotes: 0

Bryan Oakley
Bryan Oakley

Reputation: 385980

There is nothing you can do. Tkinter uses a native menu object for the menus, which means they will have exactly the same look and feel of other windows menus.

Upvotes: 2

Related Questions