Custom icon in Messagebox class #134
-
Hi everyone! Thanks so much! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
yes, you can create a custom https://ttkbootstrap.readthedocs.io/en/latest/api/dialogs/messagedialog/ import ttkbootstrap as ttk
from ttkbootstrap.dialogs import MessageDialog
import pathlib
app = ttk.Window()
imgfile = pathlib.Path(__file__).parent / 'study.png'
imgbytes = imgfile.read_bytes()
md = MessageDialog('This is my message', icon=imgbytes)
md.show()
app.mainloop() To build a MessageDialog with no icon, simply exclude the icon parameter. import ttkbootstrap as ttk
from ttkbootstrap.dialogs import MessageDialog
app = ttk.Window()
md = MessageDialog('This is my message')
md.show()
app.mainloop() |
Beta Was this translation helpful? Give feedback.
-
@lupon1, this should now work as expected with a fix in #137. # set default icon using photoimage
root.iconphoto(1, image)
# remove the default icon
root.iconphoto(1, '')
# set the icon for this window only
root.iconphoto(0, image)
# set the default bitmap (.ico)
root.iconbitmap(default=bitmap)
# remove the default bitmap
root.iconbitmap(default='')
# set the bitmap for this window only
root.iconbitmap(bitmap) |
Beta Was this translation helpful? Give feedback.
-
Hi Israel, I found a way to change the icon of a customized dialog, but need to change ttkbootstrap\dialogs source, |
Beta Was this translation helpful? Give feedback.
@lupon1, this should now work as expected with a fix in #137.