mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added icon on Windows for CTkToplevel, fixed #960
This commit is contained in:
parent
1396a7e484
commit
8a537076ce
|
@ -44,7 +44,7 @@ class CTk(tkinter.Tk, CTkAppearanceModeBaseClass, CTkScalingBaseClass):
|
||||||
# Set Windows titlebar icon
|
# Set Windows titlebar icon
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
customtkinter_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
customtkinter_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
self.iconbitmap(os.path.join(customtkinter_directory, "assets", "icons", "CustomTkinter_icon_Windows.ico"))
|
self.after(200, lambda: self.iconbitmap(os.path.join(customtkinter_directory, "assets", "icons", "CustomTkinter_icon_Windows.ico")))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,14 @@ class CTkToplevel(tkinter.Toplevel, CTkAppearanceModeBaseClass, CTkScalingBaseCl
|
||||||
CTkScalingBaseClass.__init__(self, scaling_type="window")
|
CTkScalingBaseClass.__init__(self, scaling_type="window")
|
||||||
check_kwargs_empty(kwargs, raise_error=True)
|
check_kwargs_empty(kwargs, raise_error=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Set Windows titlebar icon
|
||||||
|
if sys.platform.startswith("win"):
|
||||||
|
customtkinter_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
self.after(200, lambda: self.iconbitmap(os.path.join(customtkinter_directory, "assets", "icons", "CustomTkinter_icon_Windows.ico")))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
self._current_width = 200 # initial window size, always without scaling
|
self._current_width = 200 # initial window size, always without scaling
|
||||||
self._current_height = 200
|
self._current_height = 200
|
||||||
self._min_width: int = 0
|
self._min_width: int = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user