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

Function generateCode

src/frameworks/customtk/widgets/optionMenu.js:57–77  ·  view source on GitHub ↗
(variableName, parent)

Source from the content-addressed store, hash-verified

55 }
56
57 generateCode(variableName, parent){
58
59
60 const config = this.getConfigCode()
61
62 const defaultValue = this.getAttrValue("defaultValue")
63 const options = this.getAttrValue("widgetOptions").inputs
64
65 const code = [
66 `${variableName}_options = ${JSON.stringify(options)}`,
67 `${variableName}_var = ctk.StringVar(value="${options.at(1) || defaultValue || ''}")`,
68 `${variableName} = ctk.CTkOptionMenu(${parent}, variable=${variableName}_var, values=${variableName}_options)`
69 ]
70
71
72 return [
73 ...code,
74 `${variableName}.configure(${convertObjectToKeyValueString(config)})`,
75 `${variableName}.${this.getLayoutCode()}`
76 ]
77 }
78
79 getToolbarAttrs(){
80

Callers

nothing calls this directly

Calls 2

getConfigCodeMethod · 0.45

Tested by

no test coverage detected