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


Python wx.EVT_ERASE_BACKGROUND属性代码示例

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


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

示例1: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, id, title, capture, fps=15):
        # initialize screen capture
        self.capture = capture

        # determine window size and init wx.Frame
        frame,_ = freenect.sync_get_depth()
        self.imgHeight,self.imgWidth = frame.shape[:2]
        buffer = np.zeros((self.imgWidth,self.imgHeight,3),np.uint8)
        self.bmp = wx.BitmapFromBuffer(self.imgWidth, self.imgHeight, buffer)
        wx.Frame.__init__(self, parent, id, title, size=(self.imgWidth, self.imgHeight))

        # set up periodic screen capture
        self.timer = wx.Timer(self)
        self.timer.Start(1000./fps)
        self.Bind(wx.EVT_TIMER, self.NextFrame)
        
        # counteract flicker
        def disable_event(*pargs,**kwargs):
            pass
        self.Bind(wx.EVT_ERASE_BACKGROUND, disable_event)

        # create the layout, which draws all buttons and
        # connects events to class methods
        self.CreateLayout() 
开发者ID:PacktPublishing,项目名称:OpenCV-Computer-Vision-Projects-with-Python,代码行数:26,代码来源:chapter2.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, id):
        style = wx.WANTS_CHARS | wx.FULL_REPAINT_ON_RESIZE | wx.NO_BORDER
        wx.Control.__init__(self, parent, id, style = style)

        self.panel = parent

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
        wx.EVT_LEFT_UP(self, self.OnLeftUp)
        wx.EVT_LEFT_DCLICK(self, self.OnLeftDown)
        wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
        wx.EVT_MOTION(self, self.OnMotion)
        wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
        wx.EVT_CHAR(self, self.OnKeyChar)

        self.createEmptySp()
        self.updateScreen(redraw = False) 
开发者ID:trelby,项目名称:trelby,代码行数:21,代码来源:trelby.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        
        self.GLinitialized = False
        attribList = (glcanvas.WX_GL_RGBA, # RGBA
                      glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered
                      glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit

        # Create the canvas

        self.canvas = glcanvas.GLCanvas(self, attribList=attribList)

        # Set the event handlers.

        self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self._doEraseBackground)
        self.canvas.Bind(wx.EVT_SIZE, self._doSize)
        self.canvas.Bind(wx.EVT_PAINT, self._doPaint)

    # Canvas Proxy Methods 
开发者ID:CALFEM,项目名称:calfem-python,代码行数:22,代码来源:classes_wx.py

示例4: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def create_widget(self):
        if self.overlapped and self.parent._IS_GRIDBAG: return
        style = wx.FULL_REPAINT_ON_RESIZE
        if self.parent.CHILDREN in (-1, 1):  # e.g. Panel in a Frame
            size = self.parent.widget.GetClientSize()
        else:
            size = (20, 20)
        self.widget = wx.Window(self.parent_window.widget, -1, size=size, style=style)
        self.widget.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        #self.widget.SetAutoLayout(True)
        self.widget.Bind(wx.EVT_PAINT, self.on_paint)
        self.widget.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background)
        self.widget.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_drop_widget)
        self.widget.Bind(wx.EVT_MIDDLE_DOWN, misc.exec_after(self.on_select_and_paste))
        self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
        self.widget.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave)
        #self.widget.Bind(wx.EVT_CHAR_HOOK, misc.on_key_down_event)  # catch cursor keys   XXX still required? 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:edit_base.py

示例5: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, id, tabCtrl):
        wx.Window.__init__(self, parent, id)

        # MyTabCtrl
        self.tabCtrl = tabCtrl

        self.tabCtrl.add2(self)

        wx.EVT_PAINT(self, self.OnPaint)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) 
开发者ID:trelby,项目名称:trelby,代码行数:13,代码来源:misc.py

示例6: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, ctrl, cfg):
        wx.Window.__init__(self, parent, -1)

        self.cfg = cfg
        self.ctrl = ctrl

        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
        wx.EVT_PAINT(self, self.OnPaint) 
开发者ID:trelby,项目名称:trelby,代码行数:11,代码来源:titlesdlg.py

示例7: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList = attribs)    
        self.context = glcanvas.GLContext(self)
        
        self.parent = parent
        #Camera state variables
        self.size = self.GetClientSize()
        #self.camera = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)
        
        #Main state variables
        self.MousePos = [0, 0]
        self.bbox = BBox3D()  
        
        #Face mesh variables and manipulation variables
        self.mesh = None
        self.meshCentroid = None
        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayMeshVertices = True
        self.displayVertexNormals = False
        self.displayFaceNormals = False
        self.useLighting = True
        self.useTexture = False
        
        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion) 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:41,代码来源:MeshCanvas.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent):
        super(FloorplanPanel, self).__init__(parent)
        self.parent = parent
        self.img_path = parent.img_path
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_LEFT_UP, self.onClick)
        self.Bind(wx.EVT_PAINT, self.on_paint)
        self.survey_points = []
        self.data_filename = '%s.json' % self.parent.survey_title
        if os.path.exists(self.data_filename):
            self._load_file(self.data_filename)
        self.collector = Collector(self.parent.interface, self.parent.server)
        self.parent.SetStatusText("Ready.") 
开发者ID:jantman,项目名称:python-wifi-survey-heatmap,代码行数:15,代码来源:ui.py

示例9: _bind_events

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def _bind_events(self):
        """
        Bind panel and canvas events.

        Note that key-down is bound again - this allws hotkeys to work
        even if the main Frame, which defines hotkeys in menus, is not
        present. wx sents the EVT_KEY_DOWN up the chain and, if the Frame
        and hotkeys are present, executes those instead.
        At least I think that's how that works...
        See http://wxpython.org/Phoenix/docs/html/events_overview.html
        for more info.
        """
        # Canvas Events
        self.canvas.Bind(FloatCanvas.EVT_MOTION, self.on_mouse_move)
        self.canvas.Bind(FloatCanvas.EVT_MOUSEWHEEL, self.on_mouse_wheel)
        self.canvas.Bind(FloatCanvas.EVT_MIDDLE_DOWN, self.on_mouse_middle_down)
        self.canvas.Bind(FloatCanvas.EVT_MIDDLE_UP, self.on_mouse_middle_up)
        self.canvas.Bind(wx.EVT_PAINT, self._on_first_paint)
        # XXX: Binding the EVT_LEFT_DOWN seems to cause Issue #24.
        #      What seems to happen is: If I bind EVT_LEFT_DOWN, then the
        #      parent panel or application can't set focus to this
        #      panel, which prevents the EVT_MOUSEWHEEL event from firing
        #      properly.
#        self.canvas.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down)
#        self.canvas.Bind(wx.EVT_RIGHT_DOWN, self.on_mouse_right_down)
#        self.canvas.Bind(wx.EVT_LEFT_UP, self.on_mouse_left_up)
#        self.canvas.Bind(wx.EVT_KEY_DOWN, self._on_key_down)

        # This is supposed to fix flicker on mouse move, but it doesn't work.
#        self.Bind(wx.EVT_ERASE_BACKGROUND, None)

        # Panel Events
        self.Bind(csel.EVT_COLOURSELECT, self.on_color_change) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:35,代码来源:wm_core.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)
        self.init = False
        self.context = glcanvas.GLContext(self)         # <== this was missing when I wrote the book in 2015...
        
        # initial mouse position
        self.lastx = self.x = 30
        self.lasty = self.y = 30
        self.size = None
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion) 
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:17,代码来源:import_OpenGL_cube_and_cone.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator,
                 name="roundbutton"):
        """
        Default class constructor.

        :param `parent`: the L{RoundButton} parent;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `label`: the button text label;
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `style`: the button style (unused);
        :param `validator`: the validator associated to the button;
        :param `name`: the button name.
        """
        
        wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda event: None)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
        self.Bind(wx.EVT_SET_FOCUS, self.OnGainFocus)
        self.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)

        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)

        self._mouseAction = None
        self._hasFocus = False
        self._buttonRadius = 0
        
        self.SetLabel(label)
        self.InheritAttributes()
        self.SetInitialSize(size) 
开发者ID:ActiveState,项目名称:code,代码行数:43,代码来源:recipe-577951.py

示例12: bind_events

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def bind_events(self):
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e : None)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:6,代码来源:CustomWidgets.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT)
        ContextMenuMixin.__init__(self)

        self.il = wx.ImageList(self.icon_size, self.icon_size)
        # TODO: use a real icon
        self.il.Add(self.draw_blank())
        self.il.Add(self.draw_sort_arrow('up'))
        self.il.Add(self.draw_sort_arrow('down'))
        self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)

        self.update_enabled_columns()

        for i, name in enumerate(self.enabled_columns):
            column = self.columns[name]
            column.SetColumn(i)
            self.InsertColumnItem(i, column)

        self.itemData_to_row = {}
        self.index_to_itemData = {}

        self.selected_column = None
        self.SelectColumn(self.enabled_columns[0])

        cmenu = wx.Menu()
        for name in self.column_order:
            column = self.columns[name]
            id = wx.NewId()
            cmenu.AppendCheckItem(id, column.GetText())
            cmenu.Check(id, column.enabled)
            self.Bind(wx.EVT_MENU,
                      lambda e, c=column, id=id: self.toggle_column(c, id, e),
                      id=id)
        self.SetColumnContextMenu(cmenu)

        ColumnSorterMixin.__init__(self, len(self.enabled_columns))
        self._last_scrollpos = 0
        if sys.platform != "darwin":
            self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)

        self.default_rect = wx.Rect(0,0) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:43,代码来源:ListCtrl.py

示例14: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def create_widget(self):
        self.widget = wx.Window(self.parent_window.widget , self.id, style=wx.BORDER_SUNKEN | wx.FULL_REPAINT_ON_RESIZE)
        self.widget.Bind(wx.EVT_PAINT, self.on_paint)
        self.widget.Bind(wx.EVT_ERASE_BACKGROUND, lambda event:None) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:6,代码来源:custom_widget.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_ERASE_BACKGROUND [as 别名]
def __init__(self, parent, size):
        wx.Panel.__init__(self, parent, size=size)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnResize)

        self.ThumbPosition = 0.  # -1 <= ThumbPosition <= 1
        self.ThumbScrollingStartPos = None 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:13,代码来源:LogViewer.py


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