added dropdown arrow with font files

This commit is contained in:
Tom Schimansky 2022-05-30 15:35:23 +02:00
parent aa46c56da9
commit 15558b4d0f
4 changed files with 5 additions and 7 deletions

View File

@ -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: " +

View File

@ -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