| 80 | |
| 81 | |
| 82 | export class Text extends TkinterWidgetBase{ |
| 83 | |
| 84 | static widgetType = "Text" |
| 85 | |
| 86 | constructor(props) { |
| 87 | super(props) |
| 88 | |
| 89 | this.state = { |
| 90 | ...this.state, |
| 91 | size: { width: 120, height: 80 }, |
| 92 | attrs: { |
| 93 | ...this.state.attrs, |
| 94 | // placeHolder: { |
| 95 | // label: "PlaceHolder", |
| 96 | // tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string |
| 97 | // toolProps: {placeholder: "text", maxLength: 100}, |
| 98 | // value: "placeholder text", |
| 99 | // onChange: (value) => this.setAttrValue("placeHolder", value) |
| 100 | // } |
| 101 | |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | componentDidMount(){ |
| 107 | super.componentDidMount() |
| 108 | this.setAttrValue("styling.backgroundColor", "#fff") |
| 109 | this.setWidgetName("text") |
| 110 | } |
| 111 | |
| 112 | generateCode(variableName, parent){ |
| 113 | |
| 114 | const placeHolderText = this.getAttrValue("placeHolder") |
| 115 | |
| 116 | const config = convertObjectToKeyValueString(this.getConfigCode()) |
| 117 | |
| 118 | return [ |
| 119 | `${variableName} = tk.Text(master=${parent})`, |
| 120 | `${variableName}.config(${config})`, |
| 121 | `${variableName}.${this.getLayoutCode()}` |
| 122 | ] |
| 123 | } |
| 124 | |
| 125 | getToolbarAttrs(){ |
| 126 | const toolBarAttrs = super.getToolbarAttrs() |
| 127 | |
| 128 | return ({ |
| 129 | id: this.__id, |
| 130 | widgetName: toolBarAttrs.widgetName, |
| 131 | placeHolder: this.state.attrs.placeHolder, |
| 132 | size: toolBarAttrs.size, |
| 133 | |
| 134 | ...this.state.attrs, |
| 135 | |
| 136 | }) |
| 137 | } |
| 138 | |
| 139 | renderContent(){ |
nothing calls this directly
no outgoing calls
no test coverage detected