mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
fac2fa5e68
@ -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
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
import tkinter
|
import tkinter
|
||||||
import tkinter.ttk as ttk
|
import tkinter.ttk as ttk
|
||||||
from typing import Union, Callable, Tuple
|
from typing import Union, Callable, Tuple
|
||||||
@ -158,7 +159,7 @@ class CTkBaseClass(tkinter.Frame, CTkAppearanceModeBaseClass, CTkScalingBaseClas
|
|||||||
return font
|
return font
|
||||||
|
|
||||||
elif type(font) == tuple and len(font) == 1:
|
elif type(font) == tuple and len(font) == 1:
|
||||||
sys.stderr.write(f"{type(self).__name__} Warning: font {font} given without size, will be extended with default text size of current theme\n")
|
warnings.warn(f"{type(self).__name__} Warning: font {font} given without size, will be extended with default text size of current theme\n")
|
||||||
return font[0], ThemeManager.theme["text"]["size"]
|
return font[0], ThemeManager.theme["text"]["size"]
|
||||||
|
|
||||||
elif type(font) == tuple and 2 <= len(font) <= 6:
|
elif type(font) == tuple and 2 <= len(font) <= 6:
|
||||||
@ -178,8 +179,8 @@ class CTkBaseClass(tkinter.Frame, CTkAppearanceModeBaseClass, CTkScalingBaseClas
|
|||||||
elif isinstance(image, CTkImage):
|
elif isinstance(image, CTkImage):
|
||||||
return image
|
return image
|
||||||
else:
|
else:
|
||||||
sys.stderr.write(f"{type(self).__name__} Warning: Given image is not CTkImage but {type(image)}. " +
|
warnings.warn(f"{type(self).__name__} Warning: Given image is not CTkImage but {type(image)}. " +
|
||||||
f"Image can not be scaled on HighDPI displays, use CTkImage instead.\n")
|
f"Image can not be scaled on HighDPI displays, use CTkImage instead.\n")
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def _update_dimensions_event(self, event):
|
def _update_dimensions_event(self, event):
|
||||||
|
Loading…
Reference in New Issue
Block a user