mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed assets font path
This commit is contained in:
parent
bfbe4a4e5c
commit
50a8bb140e
@ -13,7 +13,3 @@ from .ctk_slider import CTkSlider
|
||||
from .ctk_switch import CTkSwitch
|
||||
from .ctk_tabview import CTkTabview
|
||||
from .ctk_textbox import CTkTextbox
|
||||
|
||||
# init canvas font character map for current platform
|
||||
from .core_rendering import CTkCanvas
|
||||
CTkCanvas.init_font_character_mapping()
|
||||
|
@ -3,6 +3,8 @@ import sys
|
||||
from .ctk_canvas import CTkCanvas
|
||||
from .draw_engine import DrawEngine
|
||||
|
||||
CTkCanvas.init_font_character_mapping()
|
||||
|
||||
# determine draw method based on current platform
|
||||
if sys.platform == "darwin":
|
||||
DrawEngine.preferred_drawing_method = "polygon_shapes"
|
||||
|
@ -10,15 +10,15 @@ from ..core_rendering import DrawEngine
|
||||
FontManager.init_font_manager()
|
||||
|
||||
# load Roboto fonts (used on Windows/Linux)
|
||||
script_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
FontManager.load_font(os.path.join(script_directory, "assets", "fonts", "Roboto", "Roboto-Regular.ttf"))
|
||||
FontManager.load_font(os.path.join(script_directory, "assets", "fonts", "Roboto", "Roboto-Medium.ttf"))
|
||||
customtkinter_directory = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
FontManager.load_font(os.path.join(customtkinter_directory, "assets", "fonts", "Roboto", "Roboto-Regular.ttf"))
|
||||
FontManager.load_font(os.path.join(customtkinter_directory, "assets", "fonts", "Roboto", "Roboto-Medium.ttf"))
|
||||
|
||||
# load font necessary for rendering the widgets (used on Windows/Linux)
|
||||
if FontManager.load_font(os.path.join(script_directory, "assets", "fonts", "CustomTkinter_shapes_font.otf")) is False:
|
||||
if FontManager.load_font(os.path.join(customtkinter_directory, "assets", "fonts", "CustomTkinter_shapes_font.otf")) is False:
|
||||
# change draw method if font loading failed
|
||||
if DrawEngine.preferred_drawing_method == "font_shapes":
|
||||
sys.stderr.write("customtkinter.__init__ warning: " +
|
||||
sys.stderr.write("customtkinter.windows.widgets.font warning: " +
|
||||
"Preferred drawing method 'font_shapes' can not be used because the font file could not be loaded.\n" +
|
||||
"Using 'circle_shapes' instead. The rendering quality will be bad!\n")
|
||||
DrawEngine.preferred_drawing_method = "circle_shapes"
|
||||
|
@ -16,12 +16,12 @@ class App(customtkinter.CTk):
|
||||
|
||||
# load images with light and dark mode image
|
||||
current_path = os.path.dirname(os.path.realpath(__file__))
|
||||
self.home_image = customtkinter.CTkImage(light_image=Image.open(current_path + "/test_images/home_dark.png"),
|
||||
dark_image=Image.open(current_path + "/test_images/home_light.png"), size=(20, 20))
|
||||
self.chat_image = customtkinter.CTkImage(light_image=Image.open(current_path + "/test_images/chat_dark.png"),
|
||||
dark_image=Image.open(current_path + "/test_images/chat_light.png"), size=(20, 20))
|
||||
self.add_user_image = customtkinter.CTkImage(light_image=Image.open(current_path + "/test_images/add_user_dark.png"),
|
||||
dark_image=Image.open(current_path + "/test_images/add_user_light.png"), size=(20, 20))
|
||||
self.home_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "home_dark.png")),
|
||||
dark_image=Image.open(os.path.join(current_path, "test_images", "home_light.png")), size=(20, 20))
|
||||
self.chat_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "chat_dark.png")),
|
||||
dark_image=Image.open(os.path.join(current_path, "test_images", "chat_light.png")), size=(20, 20))
|
||||
self.add_user_image = customtkinter.CTkImage(light_image=Image.open(os.path.join(current_path, "test_images", "add_user_dark.png")),
|
||||
dark_image=Image.open(os.path.join(current_path, "test_images", "add_user_light.png")), size=(20, 20))
|
||||
|
||||
# create navigation frame
|
||||
self.navigation_frame = customtkinter.CTkFrame(self, corner_radius=0)
|
||||
|
Loading…
Reference in New Issue
Block a user