import Widget from "../../../canvas/widgets/base" import Tools from "../../../canvas/constants/tools" class MainWindow extends Widget{ static widgetType = "main_window" constructor(props) { super(props) this.droppableTags = { exclude: ["image", "video", "media", "main_window", "toplevel"] } this.state = { ...this.state, size: { width: 700, height: 400 }, attrs: { ...this.state.attrs, title: { label: "Window Title", tool: Tools.INPUT, // the tool to display, can be either HTML ELement or a constant string toolProps: {placeholder: "Window title", maxLength: 40}, value: "Main Window", onChange: (value) => this.setAttrValue("title", value) } } } } componentDidMount(){ super.componentDidMount() this.setAttrValue("styling.backgroundColor", "#E4E2E2") this.setWidgetName("main") } generateCode(variableName, parent){ return [ `${variableName} = tk.Tk()`, `${variableName}.title("${this.getAttrValue("title")}")` ] } getToolbarAttrs(){ const toolBarAttrs = super.getToolbarAttrs() return ({ id: this.__id, widgetName: toolBarAttrs.widgetName, title: this.state.attrs.title, size: toolBarAttrs.size, ...this.state.attrs, }) } renderContent(){ return (