I can't add clicked handler for drawn figures, in this case it circle. I tried same, but for text and it work correctly, but for rectangle don't work too.
Here is the code that doesn't work:
import dearpygui.dearpygui as dpg
def change_text():
print("Clicked")
with dpg.window(width=500, height=300):
with dpg.drawlist(width=200, height=200):
dpg.draw_circle([100, 100], 100, fill=[255, 255, 255, 100], id="Circle_id")
dpg.add_clicked_handler("Circle_id", callback=change_text)
dpg.start_dearpygui()
And another one that work:
import dearpygui.dearpygui as dpg
def change_text():
print("Clicked")
with dpg.window(width=500, height=300):
dpg.add_text("some text", id="Text_id")
dpg.add_clicked_handler("Text_id", callback=change_text)
dpg.start_dearpygui()
Or if you know that there is the way to add round image button or just round button, please write how to do it.
I guess that circles (drawings) are not items per say. I tried registering an item handler to the Circle_id, but resulted in error.
Registering an item handler with drawlist works just fine, but the click is in this 200x200 defined area of the drawlist.
I think that all the handlers are moved to the global handler registry. This works for me and registers when I click on the area of the drawlist, and does not register when clicked on another part of the canvas.