为什么tkinter.按钮()显示为一些古老的操作系统风格的按钮,而messagebox类似tkinter.messagebox.showinfo()使用当前版本的操作系统提供了“确定”按钮?在
我的操作系统是Windows。不确定这个问题是否存在于Mac操作系统上,但是不管怎样,使用我工具的人都是在Windows上。在
我发现的一个示例代码片段here显示了按钮的不同之处。在
图像:
问题:
有没有办法tkinter.按钮()看起来像messagebox中的按钮,似乎使用了当前的操作系统风格?在
代码:
from tkinter import *
from tkinter import messagebox
window = Tk()
window.title("Welcome to LikeGeeks app")
window.geometry('350x200')
def clicked():
messagebox.showinfo('Message title', 'Message content')
btn = Button(window,text='Click here', command=clicked)
btn.grid(column=0,row=0)
window.mainloop()
你可以用tkinter.ttk公司它为您的TK小部件提供了一个现代OS风格的主题。来自docs的示例:
使用
tkinter.ttk
获取主题版本doc
相关问题 更多 >
编程相关推荐