-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtable.py
More file actions
31 lines (25 loc) · 1.09 KB
/
table.py
File metadata and controls
31 lines (25 loc) · 1.09 KB
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
30
31
from .config import *
state = State()
state.a1 = "A1"
state.b1 = "B1"
class TableExample(PUIView):
def content(self):
with VBox():
Label(f"A1: {state.a1}")
Label(f"B1: {state.b1}")
with Table(columnHeader=["Col 1", "Col 2", "Col 3"], rowHeader=["Row 1", "Row 2", "Row 3"]):
with TableNode():
TableNode(state.a1).set(self.on_set, 0, 0)
TableNode("A2").click(self.on_click, "A2").dblclick(self.on_dblclick, "A2")
TableNode("A3").click(self.on_click, "A3").dblclick(self.on_dblclick, "A3")
with TableNode():
TableNode(state("b1"))
TableNode("B2").click(self.on_click, "B2").dblclick(self.on_dblclick, "B2")
TableNode("B3").click(self.on_click, "B3").dblclick(self.on_dblclick, "B3")
def on_set(self, data, *args):
print("on_set", data, args)
state.a1 = data
def on_click(self, e, data):
print("on_click", data)
def on_dblclick(self, e, data):
print("on_dblclick", data)