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

Function generateCode

src/frameworks/tkinter/widgets/spinBox.js:64–92  ·  view source on GitHub ↗
(variableName, parent)

Source from the content-addressed store, hash-verified

62 }
63
64 generateCode(variableName, parent){
65
66 const min = this.getAttrValue("spinProps.min")
67 const max = this.getAttrValue("spinProps.max")
68 const step = this.getAttrValue("spinProps.step")
69 const defaultValue = this.getAttrValue("spinProps.default")
70
71 const config = {
72 from_: min,
73 to: max,
74 increment: step,
75 value: defaultValue,
76 ...this.getConfigCode()
77 }
78
79 const code = []
80 let spinBox = `${variableName} = tk.Spinbox(master=${parent})`
81 if (defaultValue){
82 code.push(`${variableName}_var = tk.IntVar(${defaultValue})`)
83 spinBox = `${variableName} = tk.Spinbox(master=${parent}, textvariable=${variableName}_var)`
84 }
85 code.push(spinBox)
86
87 return [
88 ...code,
89 `${variableName}.config(${convertObjectToKeyValueString(config)})`,
90 `${variableName}.${this.getLayoutCode()}`
91 ]
92 }
93
94 getToolbarAttrs(){
95

Callers

nothing calls this directly

Calls 2

getConfigCodeMethod · 0.45

Tested by

no test coverage detected