def setState(self, widget, state='disabled'): World().LOG().info("setState called: " + state) if widget.winfo_class() == 'TLabel': return try: widget.configure(state=state) except TclError: pass for child in widget.winfo_children(): if child.winfo_class() in ('TEntry', 'Text', 'TFrame', 'Button'): if child.winfo_class() != 'TFrame': child.configure(state=state) if child.winfo_class() == 'Text': if state == 'disabled': child.configure(background=World.getDisabledBackgroundColor()) child.configure(foreground=World.getDisabledForegroundColor()) else: child.configure(background=World.getNormalBackgroundColor()) child.configure(foreground=World.getNormalForegroundColor()) self._myState = state
def setState(self, widget, state='disabled'): World().LOG().info("setState called: " + state) if widget.winfo_class() == 'TLabel': return try: widget.configure(state=state) except TclError: pass for child in widget.winfo_children(): if child.winfo_class() in ('TEntry', 'Text', 'TFrame', 'Button'): if child.winfo_class() != 'TFrame': child.configure(state=state) if child.winfo_class() == 'Text': if state == 'disabled': child.configure( background=World.getDisabledBackgroundColor()) child.configure( foreground=World.getDisabledForegroundColor()) else: child.configure( background=World.getNormalBackgroundColor()) child.configure( foreground=World.getNormalForegroundColor()) self._myState = state
def _initStyles(self): Style().map("TEntry", foreground=[('disabled', World.getDisabledForegroundColor()), ('active', World.getNormalForegroundColor())], fieldbackground=[('disabled', World.getDisabledBackgroundColor())])