BUG ... MAIN BUG -button interaction-
In Tkinter, the command associated with a button is only executed when the mouse button is released while the mouse pointer is still over the button. This behavior mimics the native GUI standards on platforms such as Windows and ensures that accidental clicks (e.g. pressing the button but dragging away before releasing it) do not trigger the action.
In contrast, CustomTkinter executes the button's command immediately when the mouse button is pressed, regardless of whether the cursor remains over the button when it is released. This subtle difference in interaction can affect the user experience, especially when trying to replicate the behavior of the native operating system.
to me, this is an internal BUG that can only be programmed by complicated commands like “mouse released” and “request coordinates”!
You could do workaround like this:
import customtkinter as tk
class ButtonStateApp(tk.CTk):
def __init__(self):
super().__init__()
self.title("Button Release Check")
self.button = tk.CTkButton(self, text="Press and Release Me")
self.button.pack(pady=20)
self.status_label = tk.CTkLabel(self, text="Button Status: Idle")
self.status_label.pack()
# Bind the <ButtonRelease-1> event (left mouse button release)
self.button.bind("<ButtonRelease-1>", self.on_button_release)
def on_button_release(self, event):
self.status_label.configure(text="Button Status: Released")
print("Button Released!")
# Func()
if __name__ == "__main__":
app = ButtonStateApp()
app.mainloop()
Related to that, when using a ComboBox. Half of the time when selecting the dropdown, it selects the element that pops up behind the cursor. It happens mostly when the list is large, as it requires the list to appears under the cursor (in place / on top of the current combobox that was clicked). I guess this would require filling a separate issue (Especially in case this is unrelated).
I use wxPython, no need for extra hacks ;)
will consider changing