mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added dropdown arrow with font files
This commit is contained in:
parent
aa46c56da9
commit
15558b4d0f
@ -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"))
|
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)
|
# 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
|
# change draw method if font loading failed
|
||||||
if DrawEngine.preferred_drawing_method == "font_shapes":
|
if DrawEngine.preferred_drawing_method == "font_shapes":
|
||||||
sys.stderr.write("customtkinter.__init__ warning: " +
|
sys.stderr.write("customtkinter.__init__ warning: " +
|
||||||
|
Binary file not shown.
BIN
customtkinter/assets/fonts/CustomTkinter_shapes_font.otf
Normal file
BIN
customtkinter/assets/fonts/CustomTkinter_shapes_font.otf
Normal file
Binary file not shown.
@ -1011,13 +1011,11 @@ class DrawEngine:
|
|||||||
y_position - (size / 5))
|
y_position - (size / 5))
|
||||||
|
|
||||||
elif self.preferred_drawing_method == "font_shapes":
|
elif self.preferred_drawing_method == "font_shapes":
|
||||||
return False
|
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)
|
||||||
if not self._canvas.find_withtag("checkmark"):
|
self._canvas.tag_raise("dropdown_arrow")
|
||||||
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")
|
|
||||||
requires_recoloring = True
|
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
|
return requires_recoloring
|
||||||
|
Loading…
x
Reference in New Issue
Block a user