当前位置: 首页>>代码示例>>Python>>正文


Python wx.RED属性代码示例

本文整理汇总了Python中wx.RED属性的典型用法代码示例。如果您正苦于以下问题:Python wx.RED属性的具体用法?Python wx.RED怎么用?Python wx.RED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.RED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_text

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_text(self, event):
        import re
        validation_re = re.compile(r'^[a-zA-Z_]+[\w:.0-9-]*$')
        name = event.GetString()
        OK = bool( validation_re.match( name ) )
        if not OK:
            self.klass.SetBackgroundColour(wx.RED)
            compat.SetToolTip(self.klass, "Class name not valid")
        else:
            #if name in [c.widget.klass for c in common.root.children or []]:
            if self.toplevel and name in self.toplevel_names:
                self.klass.SetBackgroundColour( wx.RED )
                compat.SetToolTip(self.klass, "Class name already in use for toplevel window")
                OK = False
            elif name in self.class_names:
                # if the class name is in use already, indicate in yellow
                self.klass.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )
                compat.SetToolTip(self.klass, "Class name not unique")
                if self.toplevel and name in self.toplevel_names: OK = False
            else:
                self.klass.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                compat.SetToolTip(self.klass, "")
        self.klass.Refresh()
        self.btnOK.Enable(OK)
        event.Skip() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:27,代码来源:window_dialog.py

示例2: _on_text

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def _on_text(self, event):
        if self.deactivated or self.blocked: return
        text = event.GetString()
        if not self.validation_re:
            if self.control_re.search(text):
                # strip most ASCII control characters
                self.text.SetValue(self.control_re.sub("", text))
                wx.Bell()
                return
        elif self.check(text):
            self.text.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            self.text.Refresh()
        else:
            self.text.SetBackgroundColour(wx.RED)
            self.text.Refresh()
        event.Skip() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:18,代码来源:new_properties.py

示例3: _check

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def _check(self, klass, ctrl=None):
        # called by _on_text and create_text_ctrl to validate and indicate
        if not self.text and not ctrl: return
        if ctrl is None: ctrl = self.text
        if not self.validation_re.match(klass):
            ctrl.SetBackgroundColour(wx.RED)
            compat.SetToolTip(ctrl, "Name is not valid.")
        else:
            msg = self._check_class_uniqueness(klass)
            if not msg:
                ctrl.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                compat.SetToolTip( ctrl, self._find_tooltip() )
            else:
                ctrl.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )  # YELLOW
                compat.SetToolTip(ctrl, msg)
        ctrl.Refresh() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:18,代码来源:new_properties.py

示例4: on_name_edited

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_name_edited(self, event):
        value = self.name.GetValue()
        if not value or self.name_re.match(value):
            self.name.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.name.SetBackgroundColour(wx.RED)
            valid = False
        if value and valid and not self._ignore_events:
            # check for double names
            for i in range(self.items.GetItemCount()):
                if i==self.selected_index: continue
                if value == self._get_item_text(i, "name"):
                    valid = False
                    self.name.SetBackgroundColour( wx.Colour(255, 255, 0, 255) )  # YELLOW
                    break
        self.name.Refresh()
        self._on_edited(event, "name", value, valid) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:menubar.py

示例5: SetDayAttr

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def SetDayAttr(self, day, has_event):
        if has_event:
            attr = CalendarDateAttr()
            attr.SetTextColour(wx.RED)
            self.SetAttr(day, attr)
        else:
            self.ResetAttr(day) 
开发者ID:cmpilato,项目名称:thotkeeper,代码行数:9,代码来源:app.py

示例6: on_button_plot

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_button_plot(self, event):
        import numpy
        xmin = xmax = step = None
        try:
            xmin = float( self.text_xmin.GetValue() )
            self.text_xmin.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xmin.SetBackgroundColour(wx.RED)
        try:
            xmax = float( self.text_max.GetValue() )
            self.text_max.SetBackgroundColour(wx.WHITE)
        except:
            self.text_max.SetBackgroundColour(wx.RED)
        try:
            step = float( self.text_xstep.GetValue() )
            self.text_xstep.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xstep.SetBackgroundColour(wx.RED)
            
        x = numpy.arange(xmin, xmax, step)
        # build globals with some functions
        g = {}
        for name in ["sin","cos","tan","ufunc","square"]:
            g[name] = getattr(numpy, name)
        y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
        self.matplotlib_canvas.axes.plot(x,y)
        self.matplotlib_canvas.draw()
        event.Skip() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:30,代码来源:matplotlib_example.py

示例7: on_button_plot

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_button_plot(self, event):  # wxGlade: MyFrame.<event_handler>
        import numpy
        xmin = xmax = step = None
        try:
            xmin = float( self.text_xmin.GetValue() )
            self.text_xmin.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xmin.SetBackgroundColour(wx.RED)
        try:
            xmax = float( self.text_max.GetValue() )
            self.text_max.SetBackgroundColour(wx.WHITE)
        except:
            self.text_max.SetBackgroundColour(wx.RED)
        try:
            step = float( self.text_xstep.GetValue() )
            self.text_xstep.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xstep.SetBackgroundColour(wx.RED)

        # build globals for the eval() call with some functions
        g = {}
        for name in ["sin","cos","tan","ufunc","square"]:
            g[name] = getattr(numpy, name)
        # calculate the x and y values
        x = numpy.arange(xmin, xmax, step)
        y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
        data = numpy.stack( (x,y), 1 )
        # plot them
        lines = wx.lib.plot.PolyLine( data, colour=self.choice_colour.GetStringSelection() )
        self.plot_datasets.append(lines)
        graphics = wx.lib.plot.PlotGraphics(self.plot_datasets, "Title", "X", "Y")
        self.plot_canvas.Draw(graphics)

        event.Skip()

# end of class MyFrame 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:38,代码来源:lib_plot_example.py

示例8: on_button_plot

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_button_plot(self, event):  # wxGlade: MyFrame.<event_handler>
        import numpy
        xmin = xmax = step = None
        try:
            xmin = float( self.text_xmin.GetValue() )
            self.text_xmin.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xmin.SetBackgroundColour(wx.RED)
        try:
            xmax = float( self.text_max.GetValue() )
            self.text_max.SetBackgroundColour(wx.WHITE)
        except:
            self.text_max.SetBackgroundColour(wx.RED)
        try:
            step = float( self.text_xstep.GetValue() )
            self.text_xstep.SetBackgroundColour(wx.WHITE)
        except:
            self.text_xstep.SetBackgroundColour(wx.RED)
            
        x = numpy.arange(xmin, xmax, step)
        # build globals with some functions
        g = {}
        for name in ["sin","cos","tan","ufunc","square"]:
            g[name] = getattr(numpy, name)
        y = eval(self.text_function.GetValue(), g, {"numpy":numpy, "x":x})
        self.matplotlib_axes.plot(x,y)
        self.matplotlib_canvas.draw()
        event.Skip()

# end of class MyFrame 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:32,代码来源:matplotlib_example.py

示例9: _get_float

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def _get_float(self, control):
        # returns a float or None if not a valid float
        try:
            ret = float( control.GetValue() )
            colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
            control.SetBackgroundColour(colour)
        except:
            control.SetBackgroundColour(wx.RED)
            wx.Bell()
            ret = None
        control.Refresh()
        return ret

    ####################################################################################################################
    # mouse actions 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:17,代码来源:matplotlib_example.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def __init__(self, colors_dict, parent=None):
        wx.Dialog.__init__(self, parent, -1, "")
        self.colors_dict = colors_dict
        choices = list( self.colors_dict.keys() )
        choices.sort()

        self.panel_1 = wx.Panel(self, -1)
        self.use_null_color = wx.RadioButton( self.panel_1, -1, "wxNullColour", style=wx.RB_GROUP )
        self.use_sys_color = wx.RadioButton( self.panel_1, -1, _("System Color") )
        self.sys_color = wx.ComboBox( self.panel_1, -1, choices=choices, style=wx.CB_DROPDOWN | wx.CB_READONLY)
        self.sys_color_panel = wx.Panel(self.panel_1, -1, size=(250, 20))
        self.sys_color_panel.SetBackgroundColour(wx.RED)
        self.use_chooser = wx.RadioButton(self.panel_1, -1, _("Custom Color"))
        self.color_chooser = PyColourChooser(self, -1)
        self.ok = wx.Button(self, wx.ID_OK, _("OK"))
        self.cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel"))

        self.__set_properties()
        self.__do_layout()

        self.use_null_color.Bind(wx.EVT_RADIOBUTTON, self.on_use_null_color)
        self.use_sys_color.Bind(wx.EVT_RADIOBUTTON, self.on_use_sys_color)
        self.use_chooser.Bind(wx.EVT_RADIOBUTTON, self.on_use_chooser)
        self.sys_color.Bind(wx.EVT_COMBOBOX, self.display_sys_color)
        self.display_sys_color()
        for ctrl in (self.use_null_color, self.use_sys_color, self.use_chooser):
            ctrl.Bind(wx.EVT_LEFT_DCLICK, lambda evt: self.EndModal(wx.ID_OK) ) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:29,代码来源:color_dialog.py

示例11: update_display

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def update_display(self, start_editing=False):
        # when the value has changed
        if start_editing: self.editing = True
        if not self.editing: return
        checked = self.get_list_value()
        for i,checkbox in enumerate(self._choices):
            if checkbox is None: continue
            name = self._names[i]
            if checked[i] and not checkbox.GetValue():
                checkbox.SetValue(True)
            elif not checked[i] and checkbox.GetValue():
                checkbox.SetValue(False)
            # display included flags in grey and excluded flags red
            if self.EXCLUDES:
                excludes = self.EXCLUDES.get(name, [])
            else:
                excludes = self.style_defs[name].get("exclude",[])
            default_color = wx.BLACK if not "rename_to" in self.style_defs[name] else wx.Colour(130,130,130)
            if checked[i] and not name in self.value_set:
                checkbox.SetForegroundColour(wx.Colour(120,120,100))  # grey
            elif self.value_set.intersection( excludes ):
                checkbox.SetForegroundColour(wx.RED)
            else:
                supported_by = self.style_defs.get(name, {}).get("supported_by", None)
                if supported_by:
                    checkbox.SetForegroundColour(wx.BLUE)
                else:
                    checkbox.SetForegroundColour(default_color)
            if self.EXCLUDES2 and name in self.EXCLUDES2:
                checkbox.SetForegroundColour(wx.RED)
                checkbox.Disable()
            elif self.EXCLUDES2 is not None:
                checkbox.Enable()
            checkbox.Refresh()

    ####################################################################################################################
    # helpers for CheckBox tooltips 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:39,代码来源:new_properties.py

示例12: on_text_editor

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_text_editor(self, event):
        # editor text control content changed; validate and display result / update values
        ctrl = event.GetEventObject()
        col = self.editors.index( ctrl )
        if not self._validate(self.cur_row, col, event.GetString(), bell=False ):
            ctrl.SetBackgroundColour(wx.RED)
            return
        ctrl.SetBackgroundColour(wx.NullColour)
        event.Skip() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:11,代码来源:new_properties.py

示例13: on_event_handler_edited

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_event_handler_edited(self, event):
        value = self.event_handler.GetValue()
        if not value or self.handler_re.match(value):
            self.event_handler.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.event_handler.SetBackgroundColour(wx.RED)
            valid = False
        self.event_handler.Refresh()
        self._on_edited(event, "event_handler", value, valid) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:12,代码来源:menubar.py

示例14: on_event_handler_edited

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def on_event_handler_edited(self, event):
        value = self.handler.GetValue()
        if not value or self.handler_re.match(value):
            self.handler.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
            valid = True
        else:
            self.handler.SetBackgroundColour(wx.RED)
            valid = False
        self.handler.Refresh()
        self._on_edited(event, "handler", value, valid) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:12,代码来源:toolbar.py

示例15: update_view

# 需要导入模块: import wx [as 别名]
# 或者: from wx import RED [as 别名]
def update_view(self, selected):
        if self._btn is None: return
        if selected:
            color = wx.RED
        else:
            color = compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE)
        self._btn.SetBackgroundColour(color)
        self._btn.Refresh(True)

    # add/insert/free slots; interface mainly from context menus ####################################################### 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:12,代码来源:edit_sizers.py


注:本文中的wx.RED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。