-
-
Notifications
You must be signed in to change notification settings - Fork 699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resubmission of questions:The drop_callback and drop_callback arguments in the add_button function are not called correctly. #2432
Comments
To get a brief description of how to use drag and drop, run the demo and expand the "Drag & Drop" section and further the "Help" sub-section. Then, as @nvglucifer suggested in the older ticket, open Here's a corrected version of your example where both callbacks get called. I commented out import dearpygui.dearpygui as dpg
dpg.create_context()
dpg.create_viewport(title='123')
def function():
print("run?")
def cc(a,b,c):
print("no run?")
# dpg.set_item_pos("drag_1", dpg.get_mouse_pos())
with dpg.window(label="Tutorial",tag="main_window_1",horizontal_scrollbar=True,no_move=True,width=800,height=600):
dpg.add_text("xxx", tag="tooltip_parent")
dpg.add_button(label="but1",tag="drop_1",drop_callback=function)
dpg.add_button(label="but2",tag="drag_tar",drag_callback=cc)
with dpg.drag_payload(parent=dpg.last_item()):
dpg.add_text("Dragged data")
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui() A few words on
P.S. @nvglucifer please take a look at this description of |
Thank you very much for your reply, I probably understand how to use the drag_callback parameter. However, the drop_callback parameter is still unclear how it will be used. Could you give me another example? |
|
@v-ein Yes, I will modify a point about |
Thank you very much, I've studied for a long time and finally know how to use it easily |
Version of Dear PyGui
Version: 1.11.1
Operating System: Windows 11
My Issue/Question
I want to know the correct usage of the drop_callback and drag_callback arguments, I have bound two functions in my code that do not see printed results, is this really called?
To Reproduce
Steps to reproduce the behavior:
run code
Expected behavior
According to the documentation, adding the drop_callback parameter and drag_callback should implement the control to follow my mouse to change the coordinate
Standalone, minimal, complete and verifiable example
The text was updated successfully, but these errors were encountered: