MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / __init__

Method __init__

scripts/python/ui/ui_demo.py:15–255  ·  view source on GitHub ↗
(self, screen: ui.Screen)

Source from the content-addressed store, hash-verified

13 """
14
15 def __init__(self, screen: ui.Screen):
16 self.window = window = ui.Window(
17 parent=screen, title="Widgets", position=[900, 10], size=[500, 1000]
18 )
19 self.widgets = []
20
21 basic_group = ui.Group(parent=window, label="Basic widgets")
22
23 text = ui.Text(parent=basic_group, text="Text widget\nwith multiple lines\nof plain text")
24
25 button = ui.Button(
26 parent=basic_group,
27 label="Button widget",
28 callback=lambda: print("Button clicked!"),
29 )
30
31 checkbox = ui.Checkbox(
32 parent=basic_group,
33 label="Checkbox widget",
34 value=True,
35 change_callback=lambda: print(
36 f"Checkbox value changed to {checkbox.value}"
37 ),
38 )
39
40 combobox = ui.Combobox(
41 parent=basic_group,
42 label="Combobox widget",
43 items=["Item 1", "Item 2", "Item 3"],
44 value=1,
45 change_callback=lambda: print(
46 f"Combobox value changed to {combobox.value} ({combobox.items[combobox.value]})"
47 ),
48 )
49
50 progress_bar = ui.ProgressBar(parent=basic_group, fraction=0.5)
51
52 self.widgets += [text, button, checkbox, combobox, progress_bar]
53
54 drag_group = ui.Group(parent=window, label="Drag widgets")
55
56 drag_int = ui.DragInt(
57 parent=drag_group,
58 label="DragInt widget",
59 value=10,
60 change_callback=lambda: print(f"DragInt value changed to {drag_int.value}"),
61 )
62
63 drag_int2 = ui.DragInt2(
64 parent=drag_group,
65 label="DragInt2 widget",
66 value=[10, 20],
67 change_callback=lambda: print(
68 f"DragInt2 value changed to {drag_int2.value}"
69 ),
70 )
71
72 drag_int3 = ui.DragInt3(

Callers

nothing calls this directly

Calls 8

set_widgets_enabledMethod · 0.95
TextMethod · 0.80
ButtonMethod · 0.80
CheckboxMethod · 0.80
ComboboxMethod · 0.80
WindowMethod · 0.45
GroupMethod · 0.45
ProgressBarMethod · 0.45

Tested by

no test coverage detected