isl-org / isl-org/Open3D

Python: visualization.gui.RadioButton - Selection disabled for multiple instances and existing names

Open
#6,117 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

Let's assume there are two RadioButtons attached to a window (or similar) of the same GUI instance. Create at least two RadioButtons with the same names for an arbitrary number of their items. Then, selecting the buttons of any RadioButton added to the environment after the first with the same name as an already existing one will not trigger any subsequent action nor will the visualization be adjusted. It looks like the user interaction is more or less being ignored. Making sure the names for the items added to the RadioButtons are unique resolves the issue.

I list a minimal example reproducing the issue here:
```python
import open3d.visualization.gui as gui

def foo(idx):
print(idx)

gui.Application.instance.initialize()
window = gui.Application.instance.create_window("test", 480, 270)

items = [str(x) for x in range(5)]

radio_button1 = gui.RadioButton(gui.RadioButton.HORIZ)
radio_button1.set_items(items)
radio_button1.set_on_selection_changed(foo)

items[3] = str(10)

radio_button2 = gui.RadioButton(gui.RadioButton.HORIZ)
radio_button2.set_items(list(reversed(items)))
radio_button2.set_on_selection_changed(foo)

radio_button3 = gui.RadioButton(gui.RadioButton.HORIZ)
radio_button3.set_items(items)
radio_button3.set_on_selection_changed(foo)

panel = gui.Vert()
panel.add_child(radio_button1)
panel.add_child(radio_button2)
panel.add_child(radio_button3)

window.add_child(panel)
gui.Application.instance.run()
```

In this example, it is easy to see that clicking buttons with names "0" - "4" is impossible after the first, whereas selecting "10" is possible in the second, but again impossible in the third instance of a RadioButton.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.