From 15558b4d0f093b346aeaf207939da71e2dd6db69 Mon Sep 17 00:00:00 2001 From: Tom Schimansky Date: Mon, 30 May 2022 15:35:23 +0200 Subject: [PATCH] added dropdown arrow with font files --- customtkinter/__init__.py | 2 +- .../fonts/CustomTkinter_shapes_font-fine.otf | Bin 3304 -> 0 bytes .../assets/fonts/CustomTkinter_shapes_font.otf | Bin 0 -> 3528 bytes customtkinter/draw_engine.py | 10 ++++------ 4 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 customtkinter/assets/fonts/CustomTkinter_shapes_font-fine.otf create mode 100644 customtkinter/assets/fonts/CustomTkinter_shapes_font.otf diff --git a/customtkinter/__init__.py b/customtkinter/__init__.py index 20746ea..de010d6 100644 --- a/customtkinter/__init__.py +++ b/customtkinter/__init__.py @@ -31,7 +31,7 @@ FontManager.load_font(os.path.join(script_directory, "assets", "fonts", "Roboto" FontManager.load_font(os.path.join(script_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-fine.otf")) is False: +if FontManager.load_font(os.path.join(script_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: " + diff --git a/customtkinter/assets/fonts/CustomTkinter_shapes_font-fine.otf b/customtkinter/assets/fonts/CustomTkinter_shapes_font-fine.otf deleted file mode 100644 index 82afb14153f14432a1562c958251a6bf9ca24370..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3304 zcmbW3e^6A{702)0U2shZ(adbeg2@nKo226;YNs+moSLA30xk;6Pk~)v`5`PU?4r&D zXM&PQI3S23h@hw;V%lk&)?{pBJ8jx&`%h=`2W|6Do5>_K=^x4TkH+)xVCeVl5AxC( z+L*U<-u>S5&gb0o?!E8rbC;C3)oS&Eva2=OIXP+4CJv<%CX`D2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customtkinter/draw_engine.py @@ -1011,13 +1011,11 @@ class DrawEngine: y_position - (size / 5)) elif self.preferred_drawing_method == "font_shapes": - return False - - if not self._canvas.find_withtag("checkmark"): - self._canvas.create_text(0, 0, text="Z", font=("CustomTkinter_shapes_font", -size), tags=("checkmark", "create_text"), anchor=tkinter.CENTER) - self._canvas.tag_raise("checkmark") + if not self._canvas.find_withtag("dropdown_arrow"): + self._canvas.create_text(0, 0, text="Y", font=("CustomTkinter_shapes_font", -size), tags=("dropdown_arrow"), anchor=tkinter.CENTER) + self._canvas.tag_raise("dropdown_arrow") requires_recoloring = True - self._canvas.coords("checkmark", round(width / 2), round(height / 2)) + self._canvas.coords("dropdown_arrow", x_position, y_position) return requires_recoloring