如何在Windows下的Tkinter中更改菜单的颜色? [英] How to change the colour of menu in Tkinter under windows?

查看:657
本文介绍了如何在Windows下的Tkinter中更改菜单的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 windows xp .我想更改菜单栏,并在TKinter中标记前景和背景.但是,我无法改变.我可以在Windows XP中更改它,还是必须将其升级到Windows 7?

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()

我能够显示我想要的内容,并且我的代码在Linux中完美运行.但是,它并没有改变窗口的颜色.我是否需要使用任何其他命令才能使其正常工作?

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?

推荐答案

您无能为力. Tkinter使用本机菜单对象作为菜单,这意味着它们将具有与其他Windows菜单完全相同的外观.

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.

这篇关于如何在Windows下的Tkinter中更改菜单的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆