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