[英]Python - tkinter.messagebox cannot see title and showerror icon in macOS
我使用 tkinter 来做 GUI。 使用messagebox时,看不到标题,showerror图标是一个文件,就像这样:
这是我的环境:
这是我的代码
import tkinter
from tkinter import messagebox
window = tkinter.Tk()
window.withdraw()
messagebox.showerror(title="error title", message="for test message")
window.destroy()
我想查看标题和错误图标,就像 windows 系统一样。 我该如何解决这个问题,谢谢。
如果不同的操作系统有不同的特性,那么你可以像这样确定操作系统:
import sys
p = sys.platform
if p == "linux" or p == "linux2":
# linux
print('using linux')
elif p == "darwin":
# OS X
print('using mac')
elif p == "win32":
# Windows...
print('using windows')
或者mac设置(所以不是tkinter
)。 当前如何在 PC 上显示错误消息,因为人们期望tkinter
与此一致。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.