hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
12.92k stars 673 forks source link

Node_editor - wrong widget callback #848

Open m-holger opened 3 years ago

m-holger commented 3 years ago

Version of Dear PyGui

Version: 0.6.415 Operating System: Mint 20.1 Cinnamon

My Issue/Question

In node_editor, if 2 nodes with buttons are stacked on top of each other and the button is clicked, the callback on the bottom node is called instead of the callback of the visible top node.

To Reproduce

Run the sample and click on 8 - 5 is printed. WRONG Drag the node to different place and click on 8 again - 8 is printed. Click on 5 - 5 is printed

Expected behavior

Correct callback is executed.

Screenshots/Video

Screenshot from 2021-05-03 12-22-38 Screenshot from 2021-05-03 12-23-47

Standalone, minimal, complete and verifiable example

import dearpygui.core as dc
import dearpygui.simple as ds

with ds.window('1'):
    with ds.node_editor('2'):
        with ds.node('3'):
            with ds.node_attribute('4'):
                dc.add_button('5', callback= lambda a, b :print('5'))
        with ds.node('6'):
            with ds.node_attribute('7'):
                dc.add_button('8', callback= lambda a, b :print('8'))

dc.start_dearpygui(primary_window='1')
iFreilicht commented 3 years ago

@hoffstadt I can confirm this! It seems that the bounding boxes for the items inside the nodes are stacked from top to bottom, starting with the node that was created first. The draw order is dependent on which node was active last, but the bounding box order is not influenced by this.

hoffstadt commented 3 years ago

This appears to be related to this. Will fix when he resolves the issue in imnodes.

hoffstadt commented 2 years ago

Is this still an issue in 0.8?

Slluxx commented 1 year ago

Is this still an issue in 0.8?

@hoffstadt It is still an issue in 1.9.1 This is actually pretty severe. Unbenannt1