Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/examples/_valid_examples.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ enable = false
files = [
"viz_shapes.py",
"viz_panel.py",
"viz_listbox.py",
"viz_textblock.py",
"viz_sliders.py",
"viz_button.py",
Expand Down
66 changes: 66 additions & 0 deletions docs/examples/viz_listbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
"""
=========
ListBox2D
=========
This example shows how to use the ListBox2D.
"""

##############################################################################
# First, a bunch of imports

from fury.ui import ListBox2D
from fury.window import (
Scene,
ShowManager,
)

##############################################################################
# Creating a Scene

scene = Scene()

###############################################################################
# Create a ListBox2D with some values.

values = [
"Option 1",
"Option 2",
"Option 3",
"Option 4",
"Option 5",
"Option 6",
"Option 7",
"Option 8",
]

listbox = ListBox2D(
values=values,
position=(100, 100),
size=(300, 200),
multiselection=True,
)

###############################################################################
# Define a callback to print the current selection whenever it changes.


def on_change():
print("Selected:", listbox.selected)


listbox.on_change = on_change

###############################################################################
# Now that all the elements have been initialised, we add them to the scene.

scene.add(listbox)

if __name__ == "__main__":
current_size = (600, 500)
show_manager = ShowManager(
scene=scene,
size=current_size,
title="FURY ListBox2D Example",
)
show_manager.start()
6 changes: 3 additions & 3 deletions fury/ui/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ __all__ = [
# "Option",
# "RadioButton",
# "ComboBox2D",
# "ListBox2D",
# "ListBoxItem2D",
"ListBox2D",
"ListBoxItem2D",
# "FileMenu2D",
# "DrawShape",
# "DrawPanel",
Expand All @@ -45,7 +45,7 @@ __all__ = [
# from .containers import GridUI, ImageContainer2D, Panel2D, TabPanel2D, TabUI
# from .core import UI, Button2D, Disk2D, Rectangle2D, TextBlock2D

from .containers import Panel2D
from .containers import ListBox2D, ListBoxItem2D, Panel2D
from .context import UIContext
from .core import UI, Anchor, Disk2D, Rectangle2D, TextBlock2D
from .elements import LineSlider2D, TextButton2D, TexturedButton2D
Expand Down
Loading