(variableName, parent)
| 158 | } |
| 159 | |
| 160 | generateCode(variableName, parent){ |
| 161 | |
| 162 | |
| 163 | const labelText = this.getAttrValue("labelWidget") |
| 164 | |
| 165 | const config = convertObjectToKeyValueString(this.getConfigCode()) |
| 166 | const image = this.getAttrValue("imageUpload") |
| 167 | |
| 168 | let labelInitialization = `${variableName} = tk.Label(master=${parent}, text="${labelText}")` |
| 169 | |
| 170 | const code = [] |
| 171 | |
| 172 | if (image?.name){ |
| 173 | // code.push(`${variableName}_img = Image.open(${getPythonAssetPath(image.name, "image")})`) |
| 174 | // code.push(`${variableName}_img = ImageTk.PhotoImage(${variableName}_img)`) |
| 175 | // code.push("\n") |
| 176 | labelInitialization = `${variableName} = ImageLabel(master=${parent}, image_path=${getPythonAssetPath(image.name, "image")}, text="${labelText}", compound=tk.TOP, mode="${this.getAttrValue("imageSize.mode")}")` |
| 177 | } |
| 178 | |
| 179 | // code.push("\n") |
| 180 | code.push(labelInitialization) |
| 181 | return [ |
| 182 | ...code, |
| 183 | `${variableName}.config(${config})`, |
| 184 | `${variableName}.${this.getLayoutCode()}` |
| 185 | ] |
| 186 | } |
| 187 | |
| 188 | |
| 189 | getToolbarAttrs(){ |
nothing calls this directly
no test coverage detected