windows 如何在 Tkinter 中使用“本机”GUI 外观?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7385343/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:03:11  来源:igfitidea点击:

How to use the "native" GUI look with Tkinter?

pythonwindowstkinter

提问by orlp

By default Tkinter still uses the old Windows 2000-style widgets (random example):

默认情况下,Tkinter 仍然使用旧的 Windows 2000 风格的小部件(随机示例):

windows 2000 run dialog

Windows 2000 运行对话框

but I want it to use the Windows XP/Vista/7-style widgets instead:

但我希望它改用 Windows XP/Vista/7 风格的小部件:

windows xp run dialog

windows xp 运行对话框

How can I do this? I would prefer to use the latest style version, so Windows 7 > Vista > XP > 2000.

我怎样才能做到这一点?我更喜欢使用最新的样式版本,所以 Windows 7 > Vista > XP > 2000。

回答by David Heffernan

On Windows, use tkinter.ttkto get the the themed version of Tk.

在 Windows 上,使用tkinter.ttk获取 Tk 的主题版本。

回答by Kevin Walzer

The ttk themed widgets are what you are looking for. Be sure to use the 'vista' theme to get native appearance on Vista/Win7.

ttk 主题的小部件正是您要找的。请务必使用“vista”主题在 Vista/Win7 上获得本机外观。