[英]How to correct picture tkinter messagebox tkinter on macos
Is there a way to get pictures automatically on macos when you create a tkinter.messagebox<\/code> ?
创建
tkinter.messagebox<\/code>时,有没有办法在 macos 上自动获取图片?
I would like to get the error picture or question mark on my computer (I use macos and anaconda).
我想在我的电脑上获取错误图片或问号(我使用 macos 和 anaconda)。
from tkinter import messagebox
messagebox.showinfo("Info", "Work in progress")
messagebox.showerror("Error", "Oups...")
Normally, the icons are corrected once the script is compiled into an app (tested with pyinstaller).通常,一旦将脚本编译到应用程序中(使用 pyinstaller 测试),图标就会得到更正。 However, on macOS this is not perfect and there is still issues with some icons (like the
showerror<\/code> icon)...
但是,在 macOS 上,这并不完美,并且某些图标(如
showerror<\/code>图标)仍然存在问题......
So I suggest you to manage the icons manually with the command:所以我建议您使用以下命令手动管理图标:
root.tk.call('wm', 'iconphoto', root._w, PhotoImage(file="path/to/icon.png"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.