mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixed scaling for DropdownMenu
This commit is contained in:
@@ -21,6 +21,7 @@ class DrawEngine:
|
||||
- draw_rounded_progress_bar_with_border()
|
||||
- draw_rounded_slider_with_border_and_button()
|
||||
- draw_checkmark()
|
||||
- draw_dropdown_arrow()
|
||||
|
||||
"""
|
||||
|
||||
@@ -986,3 +987,37 @@ class DrawEngine:
|
||||
self._canvas.coords("checkmark", round(width / 2), round(height / 2))
|
||||
|
||||
return requires_recoloring
|
||||
|
||||
def draw_dropdown_arrow(self, x_position: Union[int, float], y_position: Union[int, float], size: Union[int, float]) -> bool:
|
||||
""" Draws a dropdown bottom facing arrow at (x_position, y_position) in a given size
|
||||
|
||||
returns bool if recoloring is necessary """
|
||||
|
||||
x_position, y_position, size = round(x_position), round(y_position), round(size)
|
||||
requires_recoloring = False
|
||||
|
||||
if self.preferred_drawing_method == "polygon_shapes" or self.preferred_drawing_method == "circle_shapes":
|
||||
if not self._canvas.find_withtag("dropdown_arrow"):
|
||||
self._canvas.create_line(0, 0, 0, 0, tags=("dropdown_arrow"), width=round(size / 4), joinstyle=tkinter.MITER, capstyle=tkinter.ROUND)
|
||||
self._canvas.tag_raise("dropdown_arrow")
|
||||
requires_recoloring = True
|
||||
|
||||
self._canvas.coords("dropdown_arrow",
|
||||
x_position - (size / 2),
|
||||
y_position - (size / 5),
|
||||
x_position,
|
||||
y_position + (size / 5),
|
||||
x_position + (size / 2),
|
||||
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")
|
||||
requires_recoloring = True
|
||||
|
||||
self._canvas.coords("checkmark", round(width / 2), round(height / 2))
|
||||
|
||||
return requires_recoloring
|
||||
|
||||
Reference in New Issue
Block a user