-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcombobox.py
More file actions
29 lines (24 loc) · 801 Bytes
/
Copy pathcombobox.py
File metadata and controls
29 lines (24 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from .config import *
state = State()
state.index = -1
state.text = ""
@PUI
def ComboboxExample():
with VBox():
Label(f"Index: {state.index}")
Label(f"Text: {state.text}")
with HBox():
Label("Readonly")
with ComboBox(editable=False, text_model=state("text")):
ComboBoxItem("Item 1", "Value 1")
ComboBoxItem("Item 2", "Value 2")
ComboBoxItem("Item 3", "Value 3")
Spacer()
with HBox():
Label("Editable")
with ComboBox(editable=True, index_model=state("index"), text_model=state("text")):
ComboBoxItem("Item 1")
ComboBoxItem("Item 2")
ComboBoxItem("Item 3", "Value 3")
Spacer()
Spacer()