79174916

Date: 2024-11-10 12:44:47
Score: 0.5
Natty:
Report link

finnally found the solution after long hours of internet search.

you must add these 2 lines :

def create_image(image_data, width, height, image_tag, texture_tag):
    with dpg.texture_registry():
        texture_id = dpg.add_static_texture(width, height, image_data, tag=texture_tag)

    # Add the image with drag and drop functionality
    dpg.add_image_button(texture_id, tag=image_tag, payload_type="image_payload", drag_callback=drag_callback, drop_callback=drop_callback)

    # add this to enable drap&drop:
    with dpg.drag_payload(parent=image_tag, drag_data="dragdata", payload_type="image_payload"):
        dpg.add_text("popup drag")
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Jack Wolf