2017-03-29 34 views
0

我有一个小型的Python GUI,它只是微软记事本的一个较小且不太先进的版本。它允许加载和保存文件等,以及一些其他基本菜单选项,如退出。是否可以在Tkinter中获得Windows 10样式按钮? (Python 3.5.2)

Tkinter通常很适合创建这样的程序,但我想知道是否有可能使用更好看的Windows 10按钮而不是卡在看起来相当丑陋的Tkinter中。 (请参阅下面的区别,Tkinter是最上面的图片,Windows是更低的)。

enter image description here

enter image description here

我知道这是一个有点一个不起眼的问题,但如果有人知道这是否是可能的,我会很高兴。没有什么让我比看起来干净的程序更开心:)我有我的疑惑,尽管...

下面是我用于当前按钮的代码(我知道如何尴尬.place是,但它适用于我分钟):)

yes = Button(confirmation, text = "Yes", command = ProgramTerminate, width = 5, height = 1) 
yes.place(x = 100, y = 25) 

no = Button(confirmation, text = "No", command = confirmation.destroy, width = 5, height = 1) 
no.place(x = 150, y = 25) 

回答

2

号你可以在窗口获得通过TTK 7ish看:

from tkinter import ttk 
yes = ttk.Button(confirmation, text = "Yes", command = ProgramTerminate, width = 5, height = 1) 

不过,我看你是一个是/否消息框。您可以拨打系统的版本messagebox.askyesno

from tkinter import messagebox 

response = messagebox.askyesno("Really Quit?", "Are you sure you want to quit?") 
if response: 
    ProgramTerminate() 
+0

谢谢!比我所做的更接近,现在看起来更专业了:) –

相关问题