Exemple #1
0
    def Enable(self, *args, **kwargs):
        # Clearing text area is done as workaround for text background color bug
        current_value = self.MainCtrl.GetValue()
        insertion_point = self.MainCtrl.GetInsertionPoint()
        self.MainCtrl.Clear()

        return_value = BorderedPanel.Enable(self, *args, **kwargs)

        if self.IsEnabled():
            self.SetBackgroundColour(self.clr_enabled)

            # Older versions of wx do not change color of disabled multiline text control
            if wx.MAJOR_VERSION < 3:
                self.MainCtrl.SetBackgroundColour(self.clr_enabled)

        else:
            self.SetBackgroundColour(self.clr_disabled)

            # Older versions of wx do not change color of disabled multiline text control
            if wx.MAJOR_VERSION < 3:
                self.MainCtrl.SetBackgroundColour(self.clr_disabled)

        # Reinstate the text
        self.MainCtrl.SetValue(current_value)
        self.MainCtrl.SetInsertionPoint(insertion_point)

        return return_value
Exemple #2
0
    def Enable(self, *args, **kwargs):
        self.MainCtrl.Enable(*args, **kwargs)

        return BorderedPanel.Enable(self, *args, **kwargs)