MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / generateCode

Method generateCode

src/frameworks/tkinter/widgets/slider.js:99–120  ·  view source on GitHub ↗
(variableName, parent)

Source from the content-addressed store, hash-verified

97 }
98
99 generateCode(variableName, parent){
100 // TODO: add orientation
101
102 const config = this.getConfigCode()
103
104 config["from_"] = this.getAttrValue("scale.min")
105 config["to"] = this.getAttrValue("scale.max")
106 config["resolution"] = this.getAttrValue("scale.step")
107
108 if (this.getAttrValue("orientation")){
109 config["orientation"] = this.getAttrValue("orientation")
110 }
111
112 const defaultValue = this.getAttrValue("scale.default")
113
114 return [
115 `${variableName}_var = tk.DoubleVar(value=${defaultValue})`,
116 `${variableName} = tk.Scale(master=${parent}, variable=${variableName}_var)`,
117 `${variableName}.config(${convertObjectToKeyValueString(config)})`,
118 `${variableName}.${this.getLayoutCode()}`
119 ]
120 }
121
122 getToolbarAttrs(){
123

Callers

nothing calls this directly

Calls 2

getConfigCodeMethod · 0.45

Tested by

no test coverage detected