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

Function constructor

src/frameworks/tkinter/widgets/label.js:17–92  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

15 // static requiredCustomPyFiles = ["imageLabel"]
16
17 constructor(props) {
18 super(props)
19
20
21 this.state = {
22 ...this.state,
23 widgetName: "Label",
24 size: { width: 80, height: 40 },
25 attrs: {
26 ...this.state.attrs,
27 styling: {
28 ...this.state.attrs.styling,
29 anchor: {
30 label: "Text align",
31 tool: Tools.SELECT_DROPDOWN,
32 options: ANCHOR.map((val) => ({value: val, label: val})),
33 value: "",
34 onChange: (value) => {
35
36 this.setAttrValue("styling.anchor", value)
37
38 this.setState((prevState) => ({
39 widgetInnerStyle: {
40 ...prevState,
41 ...this.getAnchorStyle(value)
42 }
43 }))
44 }
45 }
46 },
47 labelWidget: {
48 label: "Text",
49 tool: Tools.INPUT,
50 toolProps: {placeholder: "text", maxLength: 100},
51 value: "Label",
52 onChange: (value) => this.setAttrValue("labelWidget", value)
53 },
54 imageUpload: {
55 label: "Image",
56 tool: Tools.UPLOADED_LIST,
57 toolProps: {filterOptions: ["image/jpg", "image/jpeg", "image/png"]},
58 value: "",
59 onChange: (value) => this.setAttrValue("imageUpload", value)
60 },
61 imageSize: {
62 label: "Image size",
63 display: "horizontal",
64 // width: {
65 // label: "Width",
66 // tool: Tools.NUMBER_INPUT, // the tool to display, can be either HTML ELement or a constant string
67 // toolProps: { placeholder: "width", max: 3000, min: 1 },
68 // value: 150,
69 // onChange: (value) => this.setWidgetSize(value, null)
70 // },
71 // height: {
72 // label: "Height",
73 // tool: Tools.NUMBER_INPUT,
74 // toolProps: { placeholder: "height", max: 3000, min: 1 },

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected