示例#1
0
    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
示例#2
0
    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
示例#3
0
 def _initStyles(self):
     Style().map("TEntry",
                 foreground=[('disabled',
                              World.getDisabledForegroundColor()),
                             ('active', World.getNormalForegroundColor())],
                 fieldbackground=[('disabled',
                                   World.getDisabledBackgroundColor())])