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

Class Input

src/frameworks/tkinter/widgets/input.js:6–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6export class Input extends TkinterWidgetBase{
7
8 static widgetType = "entry"
9 static displayName = "Entry"
10
11 constructor(props) {
12 super(props)
13
14 this.state = {
15 ...this.state,
16 size: { width: 120, height: 40 },
17 widgetName: "Entry",
18 attrs: {
19 ...this.state.attrs,
20 placeHolder: {
21 label: "PlaceHolder",
22 tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string
23 toolProps: {placeholder: "text", maxLength: 100},
24 value: "placeholder text",
25 onChange: (value) => this.setAttrValue("placeHolder", value)
26 }
27
28 }
29 }
30 }
31
32 componentDidMount(){
33 super.componentDidMount()
34 this.setAttrValue("styling.backgroundColor", "#fff")
35 }
36
37 generateCode(variableName, parent){
38
39 const placeHolderText = this.getAttrValue("placeHolder")
40
41 const config = convertObjectToKeyValueString(this.getConfigCode())
42
43 return [
44 `${variableName} = tk.Entry(master=${parent})`,
45 `${variableName}.config(${config})`,
46 `${variableName}.${this.getLayoutCode()}`
47 ]
48 }
49
50 getToolbarAttrs(){
51
52 const toolBarAttrs = super.getToolbarAttrs()
53
54 return ({
55 id: this.__id,
56 widgetName: toolBarAttrs.widgetName,
57 placeHolder: this.state.attrs.placeHolder,
58 size: toolBarAttrs.size,
59
60 ...this.state.attrs,
61
62 })
63 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected