asweigart / PyMsgBox

Simple, cross-platform, pure Python module to display message boxes, and just message boxes.
BSD 3-Clause "New" or "Revised" License
59 stars 18 forks source link

Add window icon option #16

Open gmertes opened 10 months ago

gmertes commented 10 months ago

Adds the icon parameter to all exported functions. This allows the user to overwrite the default Tk window icon.

icon takes a bitmap in the standard forms accepted by Tk (primitives 'info', 'warning', 'question' etc), an icon file (ico, xbm) or any valid Tk PhotoImage file (png, gif, ppm/pgm).

Compatibility is maintained with the Windows native functions. On Windows, only system icons are available and are accessed using the Tk bitmap primitives 'info', 'warning', 'stop', and 'question'. If an image file is specified on Windows, the icon will be empty.

Examples:

from pymsgbox import *
alert(text='test', title='test', icon='icon.ico')

image

alert(text='test', title='test', icon='question')

image

Windows native:

alert(text='test', title='test', icon='question')

image