Running the UI commands.
1
2import coat
3
4
5
6
7
8
9class MyClass :
10 def __init__(self) :
11 self.Integer = 0
12 self.IntSlider = 0
13 self.Float = 0.0
14 self.FloatSlider = 0.5
15 self.Checkbox = False
16 self.Radio1 = True
17 self.Radio2 = False
18 self.Droplist = 0
19 self.String = "text"
21 self.Color = 'FF0000'
22 self.String = ''
23 self.OpenFilepath = ''
24 self.SaveFilepath = ''
25 self.Droplist = "Case2"
26 self.idx=1
27 self.items=[]
28
29 def One(self) :
31
32 def Two(self) :
34
35 def ZeroCoordinate(self) :
37
38 def add(self):
39 self.items.append(Item(self.idx))
40 self.idx+=1
41
42
43
44 def ui(self) :
45
46
47
48 return [
49 "#image:data/StartMenu/images/header.png",
50 "#Just centered text message there",
51 "#*Left-aligned text",
52 "Integer",
53 "IntSlider,[0,100]",
54 "Float, Rename variable in UI if need",
55 "FloatSlider,[-1,1]",
56 "Checkbox",
57 "Radio1, group1",
58 "Radio2, group1",
59 "Droplist,[Case1|Case2|Case3]",
60 "Color, color",
61 "OpenFilepath,load:*.tif;*.tiff;*.exr;*.tga;*.bmp;*.png",
62 "SaveFilepath,save:*.tif;*.tiff;*.exr;*.tga;*.bmp;*.png",
63 "[1 []]",
64 "Coordinate",
65 "ZeroCoordinate,'{maticon close}'",
66 "[1 1]",
67 "One",
68 "Two",
69 "---",
70 "items",
71 "add,'{maticon add}'"
72 ]
73
74
75class Item:
76 def __init__(self, i = 0):
78 self.index = i
79
80 def X(self):
81 p.items.remove(self)
82
83 def ui(self):
84 return [
85 "[[%30] 1 []]",
86 "index,''",
87 "point,''",
88 "X,'{maticon close}'"
89 ]
90
91p = MyClass()
92
94
95def on_press(button):
96 print("pressed: ", button)
97 if(button == 1) :
98
100def process_fn():
101
102
103
104 p.Float+=1
105
106
107
108coat.dialog().ok().cancel().params(p).caption(
"caption").process(process_fn).onPress(on_press).show();
fromJsonFile(any obj, str filename)
Restore the object from the json file.
Definition coat.py:3805
str toJson(any obj, str filename="")
Store the object to the file or string as json.
Definition coat.py:3800
vec3 RandNormal()
Definition coat.py:232