Skip to content

Commit

Permalink
Add icon master to prevent crash with multiple tk instances (#270)
Browse files Browse the repository at this point in the history
* add master to PhotoImage for window icon

* bump version to 1.7.4.7
  • Loading branch information
israel-dryer authored Apr 21, 2022
1 parent 988a614 commit 63e8291
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

setuptools.setup(
name="ttkbootstrap",
version="1.7.4.6",
version="1.7.4.7",
author="Israel Dryer",
author_email="[email protected]",
description="A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.",
Expand Down
8 changes: 4 additions & 4 deletions src/ttkbootstrap/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,17 @@ def __init__(
if iconphoto is not None:
if iconphoto == '':
# the default ttkbootstrap icon
self._icon = tkinter.PhotoImage(data=Icon.icon)
self._icon = tkinter.PhotoImage(master=self, data=Icon.icon)
self.iconphoto(True, self._icon)
else:
try:
# the user provided an image path
self._icon = tkinter.PhotoImage(file=iconphoto)
self._icon = tkinter.PhotoImage(file=iconphoto, master=self)
self.iconphoto(True, self._icon)
except tkinter.TclError:
# The fallback icon if the user icon fails.
print('iconphoto path is bad; using default image.')
self._icon = tkinter.PhotoImage(data=Icon.icon)
self._icon = tkinter.PhotoImage(data=Icon.icon, master=self)
self.iconphoto(True, self._icon)

self.title(title)
Expand Down Expand Up @@ -402,7 +402,7 @@ def __init__(
if iconphoto != '':
try:
# the user provided an image path
self._icon = tkinter.PhotoImage(file=iconphoto)
self._icon = tkinter.PhotoImage(file=iconphoto, master=self)
self.iconphoto(True, self._icon)
except tkinter.TclError:
# The fallback icon if the user icon fails.
Expand Down

0 comments on commit 63e8291

Please sign in to comment.