简体   繁体   中英

Python - tkinter.messagebox cannot see title and showerror icon in macOS

I use tkinter to do GUI. When use messagebox, that can not see title and showerror icon is a file, just like that:

enter image description here

This is my env:

  1. macOS / windows 10
  2. python 3.8.13
  3. tk 8.6

And this is my code

import tkinter
from tkinter import messagebox

window = tkinter.Tk()
window.withdraw()
messagebox.showerror(title="error title", message="for test message")
window.destroy()

I want to see title and error icon, just like windows system. How can I do to fix this progrem, thanks.

If there are features that are different for different operating systems, then you can determine the operating system like this:

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')

Alternatively the mac settings (so not tkinter ). How are the error messages currently displayed on the pc as one would expect tkinter to be consistent with this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM