我正在使用 Tkinter 和guizero并尝试设置菜单栏的样式。我使用的是 Python 3.8.2
我正在努力改变的事情
删除菜单栏和选项上的边框/3D 效果。
删除菜单栏顶部填充(上方和左侧的小空间)。
为顶层/菜单栏和选项激活选择颜色。
from guizero import App, MenuBar
def file_function():
print("File option")
def about_function():
print("about option")
app = App(title="My app", height=300, width=500,bg='white')
menubar = MenuBar(app,
toplevel=["File", "About"],
options=[
[ ["New", file_function], ["Save", file_function]],
[ ["Report Bug", about_function], ["About", about_function] ]
])
menubar.bg=(111, 77, 124)
# none of the styling below works and this is what I've tried
menubar.border=0
menubar.toplevel.border=False
menubar.options.border=0
menubar.toplevel.options.bg='gray'
menubar.toplevel.focus.bg='yellow'
menubar.toplevel.focus.fg='yellow'
menubar.toplevel.options.border=False
app.display()
Run Code Online (Sandbox Code Playgroud)
图片:
更新
菜单并不意味着目前看起来不错,奇怪的颜色是为了看看什么有效,什么无效。我能够使用 guizero 小部件及其所有功能。
当前问题 …