mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
fixes for DropdownMenu
This commit is contained in:
parent
a50e2ea9ca
commit
60b13bf215
@ -998,7 +998,7 @@ class DrawEngine:
|
||||
|
||||
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.create_line(0, 0, 0, 0, tags="dropdown_arrow", width=round(size / 3), joinstyle=tkinter.ROUND, capstyle=tkinter.ROUND)
|
||||
self._canvas.tag_raise("dropdown_arrow")
|
||||
requires_recoloring = True
|
||||
|
||||
@ -1012,7 +1012,7 @@ class DrawEngine:
|
||||
|
||||
elif self.preferred_drawing_method == "font_shapes":
|
||||
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.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
|
||||
|
||||
|
@ -292,6 +292,13 @@ class CTkOptionMenu(CTkBaseClass):
|
||||
self.variable.set(self.current_value)
|
||||
self.variable_callback_blocked = False
|
||||
|
||||
if not from_variable_callback:
|
||||
if self.function is not None:
|
||||
try:
|
||||
self.function(self.current_value)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def get(self) -> str:
|
||||
return self.current_value
|
||||
|
||||
@ -303,9 +310,3 @@ class CTkOptionMenu(CTkBaseClass):
|
||||
self.on_leave()
|
||||
self.click_animation_running = True
|
||||
self.after(100, self.click_animation)
|
||||
|
||||
if self.function is not None:
|
||||
try:
|
||||
self.function()
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -7,7 +7,7 @@ ws.geometry('400x300')
|
||||
|
||||
def display_selected(choice):
|
||||
choice = variable.get()
|
||||
print(choice)
|
||||
print("display_selected", choice)
|
||||
|
||||
countries = ['Bahamas','Canada', 'Cuba','United States']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user