Exemplo n.º 1
0
    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        mwidth = 0
        mheight = 0
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            syscolor = wx.SystemSettings.GetColour(getattr(wx, val))
            dc.SetBrush(wx.Brush(syscolor))

            # Draw label
            twidth = dc.GetTextExtent(val)
            if twidth[0] > mwidth:
                mwidth = twidth[0]
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            diff = (self._maxw - twidth[0])
            nextx += (diff + twidth[0] + 8)
            dc.DrawRectangle(nextx, nexty, self._box[0], self._box[1])

            nextx = 10
            nexty += 20
Exemplo n.º 2
0
    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        mwidth = 0
        mheight = 0
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            sysfeature = wx.SystemSettings.HasFeature(getattr(wx, val))

            # Draw label
            twidth = dc.GetTextExtent(val)
            if twidth[0] > mwidth:
                mwidth = twidth[0]
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            diff = (self._maxw - twidth[0])
            nextx += (diff + twidth[0] + 8)
            dc.DrawText(repr(sysfeature), nextx, nexty)

            nextx = 10
            nexty += 20
Exemplo n.º 3
0
    def OnPaint(self, evt):
        """Paint the control"""
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GCDC(dc)

        # Setup
        dc.SetBrush(wx.TRANSPARENT_BRUSH)
        gc.SetBrush(wx.TRANSPARENT_BRUSH)
        gc.SetFont(self.GetFont())
        gc.SetBackgroundMode(wx.TRANSPARENT)
        gc.Clear()

        # Paint the background
        rect = self.GetClientRect()
        self.DoPaintBackground(gc, rect, self._color, self._color2)

        # Draw the buttons
        # TODO: would be more efficient to just redraw the buttons that
        #       need redrawing.
        npos = SegmentBar.HPAD
        if self.IsVerticalMode():
            npos = SegmentBar.VPAD
        use_labels = self._style & CTRLBAR_STYLE_LABELS
        for idx, button in enumerate(self._buttons):
            npos = self.DoDrawButton(gc, npos, idx,
                                     self._selected == idx,
                                     use_labels)
Exemplo n.º 4
0
    def _draw(self):
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GraphicsContext.Create(dc)  # Anti-aliasing
        gc.Translate(self._paint_width / 2, self._paint_height / 2)  # Center

        # Draw the background
        gc.SetBrush(wx.Brush(int_to_color(BACKGROUND_COLOR)))
        gc.SetPen(
            wx.Pen(int_to_color(BACKGROUND_BORDER_COLOR),
                   width=self._frame_pen_width))
        gc.DrawRoundedRectangle(-self._paint_width / 2,
                                -self._paint_height / 2, self._paint_width,
                                self._paint_height, self._border)

        # Draw the LEDs
        gc.Rotate(self._rotation)
        if self.flip:
            gc.Rotate(PI)
        gc.Translate(0, -self._tile_size)

        for led in self.leds:  # The led is an integer with the color
            gc.SetBrush(wx.Brush(int_to_color(led)))
            gc.SetPen(wx.Pen(int_to_darkened_color(led),
                             width=self._pen_width))
            gc.DrawEllipse(-self._radius, -self._radius, 2 * self._radius,
                           2 * self._radius)
            gc.Translate(0, self._tile_size)
Exemplo n.º 5
0
    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            syscolor = wx.SystemSettings.GetColour(getattr(wx, val))
            dc.SetBrush(wx.Brush(syscolor))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.DrawRectangle(nextx, nexty, self._box[0], self._box[1])

            nextx += self._box[0] + 12
            dc.DrawText('{}'.format(syscolor.Get()), nextx, nexty)

            nextx = 10
            nexty += 20
Exemplo n.º 6
0
    def OnPaint(self, event):
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GCDC(dc)
        renderer = wx.RendererNative.Get()

        # Setup GCDC
        rect = self.GetClientRect()
        bcolour = self.GetBackgroundColour()
        brush = wx.Brush(bcolour)
        gc.SetBackground(brush)
        gc.Clear()

        # Center checkbox
        cb_x = (rect.width - 16) / 2
        cb_y = 2  # padding from top
        cb_rect = wx.Rect(cb_x, cb_y, 16, 16)

        # Draw the checkbox
        state = 0
        if self._checked:
            state = wx.CONTROL_CHECKED
        if not self.IsEnabled():
            state |= wx.CONTROL_DISABLED
        renderer.DrawCheckBox(self, dc, cb_rect, state | self._hstate)

        # Draw the label
        lbl_rect = wx.Rect(0, cb_rect.bottom, rect.width,
                           rect.height - cb_rect.height)
        gc.DrawLabel(self.GetLabel(), lbl_rect, wx.ALIGN_CENTER)
Exemplo n.º 7
0
    def __DrawButton(self):
        """Draw the button"""
        # TODO using a buffered paintdc on windows with the nobg style
        #      causes lots of weird drawing. So currently the use of a
        #      buffered dc is dissabled for this style.
        if PB_STYLE_NOBG & self._style:
            dc = wx.PaintDC(self)
        else:
            dc = wx.AutoBufferedPaintDCFactory(self)

        gc = wx.GCDC(dc)

        # Setup
        dc.SetBrush(wx.TRANSPARENT_BRUSH)
        gc.SetBrush(wx.TRANSPARENT_BRUSH)
        gc.SetFont(self.GetFont())
        gc.SetBackgroundMode(wx.TRANSPARENT)

        # The background needs some help to look transparent on
        # on Gtk and Windows
        if wx.Platform in ['__WXGTK__', '__WXMSW__']:
            gc.SetBackground(self.GetBackgroundBrush(gc))
            gc.Clear()

        # Calc Object Positions
        width, height = self.GetSize()
        tw, th = gc.GetTextExtent(self.GetLabel())
        txt_y = max((height - th) / 2, 1)

        if self._state['cur'] == PLATE_HIGHLIGHT:
            gc.SetTextForeground(self._color['htxt'])
            gc.SetPen(wx.TRANSPARENT_PEN)
            self.__DrawHighlight(gc, width, height)

        elif self._state['cur'] == PLATE_PRESSED:
            gc.SetTextForeground(self._color['htxt'])
            if wx.Platform == '__WXMAC__':
                pen = wx.Pen(GetHighlightColour(), 1, wx.SOLID)
            else:
                pen = wx.Pen(AdjustColour(self._color['press'], -80, 220), 1)
            gc.SetPen(pen)

            self.__DrawHighlight(gc, width, height)
            txt_x = self.__DrawBitmap(gc)
            gc.DrawText(self.GetLabel(), txt_x + 2, txt_y)
            self.__DrawDropArrow(gc, txt_x + tw + 6, (height / 2) - 2)

        else:
            if self.IsEnabled():
                gc.SetTextForeground(self.GetForegroundColour())
            else:
                txt_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)
                gc.SetTextForeground(txt_c)

        # Draw bitmap and text
        if self._state['cur'] != PLATE_PRESSED:
            txt_x = self.__DrawBitmap(gc)
            gc.DrawText(self.GetLabel(), txt_x + 2, txt_y)
            self.__DrawDropArrow(gc, txt_x + tw + 6, (height / 2) - 2)
Exemplo n.º 8
0
 def OnPaint(self, event):
     """Draw the image on to the panel"""
     # Create a Buffered PaintDC
     dc = wx.AutoBufferedPaintDCFactory(self)
     #        dc = wx.PaintDC(self) # replace above line with this to see flicker
     # Transform to GCDC
     gcdc = wx.GCDC(dc)
     self.DoDrawWatch(gcdc)
Exemplo n.º 9
0
 def OnPaint(self, event):
     dc = wx.AutoBufferedPaintDCFactory(self)
     if ((not None in [self._img, self.x_center, self.y_center])
             and (self.x_center >= 0) and (self.y_center >= 0)):
         w, h = self.GetSize()
         wx_image = self._img.get_zoomed_bitmap(self.x_center,
                                                self.y_center,
                                                boxsize=w,
                                                mag=self.zoom_level)
         if (wx_image is None): return
         bitmap = wx_image.ConvertToBitmap()
         dc.DrawBitmap(bitmap, 0, 0)
         if (self.flag_show_intensities):
             values = self._img.get_intensities_in_box(x=self.x_center,
                                                       y=self.y_center,
                                                       boxsize=w,
                                                       mag=self.zoom_level)
             black = wx.Colour(0, 0, 0, 255)
             white = wx.Colour(255, 255, 255, 255)
             yellow = wx.Colour(255, 255, 0, 255)
             dc.SetFont(
                 wx.Font(self.zoom_level // 2, wx.MODERN, wx.NORMAL,
                         wx.NORMAL))
             for i, row in enumerate(values):
                 y = int(self.Size[1] / len(values) * (i + 0.5))
                 if (y > (h - 1)):
                     break
                 for j, intensity in enumerate(row):
                     x = int(self.Size[0] / len(values) * (j + 0.5))
                     if (x > (w - 1)):
                         break
                     if isinstance(intensity, float):
                         if intensity > 100:
                             fmt = "%.0f"
                         elif intensity > 10:
                             fmt = "%.1f"
                         else:
                             fmt = "%.2f"
                     else:
                         fmt = "%i"
                     txt = fmt % intensity
                     # Calculate appropriate text colour according to formula from
                     # http://ux.stackexchange.com/a/8320
                     R = wx_image.GetRed(x, y)
                     G = wx_image.GetGreen(x, y)
                     B = wx_image.GetBlue(x, y)
                     Y = 0.2126 * (R / 255)**2.2 + 0.7151 * (
                         G / 255)**2.2 + 0.0721 * (B / 255)**2.2
                     if Y < 0.18:
                         dc.SetTextForeground(
                             white)  # XXX is white or yellow better here?
                     else:
                         dc.SetTextForeground(black)
                     width, height = dc.GetTextExtent(txt)
                     dc.DrawText(txt, x - width // 2, y - height // 2)
     else:
         dc.SetPen(wx.Pen('red'))
         dc.DrawText("Right-click in the main image field to zoom.", 10, 10)
Exemplo n.º 10
0
 def OnPaint(self, event):
     dc = wx.AutoBufferedPaintDCFactory(self)
     # XXX is there any reason not to do this on all systems?  test on Linux
     if (wx.Platform == "__WXMSW__"):
         dc.SetBackground(wx.WHITE_BRUSH)
         dc.SetBackgroundMode(wx.SOLID)
         dc.Clear()
     gc = wx.GraphicsContext.Create(dc)
     self.paint(gc)
Exemplo n.º 11
0
 def OnPaint(self, event):
     if (self._img is None): return
     dc = wx.AutoBufferedPaintDCFactory(self)
     dc.SetBackground(wx.Brush((255, 255, 255)))
     dc.Clear()
     bitmap = self._img.get_thumbnail_bitmap()
     dc.SetBrush(wx.TRANSPARENT_BRUSH)
     dc.DrawBitmap(bitmap, 0, 0)
     x, y, w, h = self._img.get_thumbnail_box()
     dc.SetPen(wx.Pen('red', 2))
     dc.DrawRectangle(x, y, w - 1, h - 1)
Exemplo n.º 12
0
    def OnPaint(self, evt):
        """Paint the background to match the current style
        @param evt: wx.PaintEvent

        """
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GCDC(dc)
        rect = self.GetClientRect()

        self.DoPaintBackground(gc, rect, self._color, self._color2)

        evt.Skip()
Exemplo n.º 13
0
 def OnPaint(self, event):
     if (self.scene is None):
         return
     if (self.settings.black_background):
         self.SetBackgroundColour((0, 0, 0))
     else:
         self.SetBackgroundColour((255, 255, 255))
     dc = wx.AutoBufferedPaintDCFactory(self)
     if (self.settings.black_background):
         dc.SetBackground(wx.BLACK_BRUSH)
     else:
         dc.SetBackground(wx.WHITE_BRUSH)
     dc.Clear()
     gc = wx.GraphicsContext.Create(dc)
     self.paint(gc)
Exemplo n.º 14
0
    def __onPaint(self, event):
        dc = wx.AutoBufferedPaintDCFactory(self._canvas)

        y0 = self.GetScrollPos(wx.VERTICAL) * (self.cellHeight + self.margin)
        y1 = y0 + self.GetClientSize()[1]

        dc.SetBrush(wx.Brush(self._backgroundColor))
        dc.SetPen(wx.TRANSPARENT_PEN)

        dc.DrawRectangle(0, y0,
                         self._canvas.GetSize()[0],
                         self._canvas.GetSize()[1])

        dc.SetBrush(wx.NullBrush)
        dc.SetPen(wx.NullPen)

        for button in self.buttons:
            if button.y >= y0 and button.y <= y1:
                button.paint(dc)
Exemplo n.º 15
0
    def OnPaint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        self.SetupPaintDC(dc)

        # Draw a sample box for each system color
        nextx = 10
        nexty = 10
        column = 0
        row_count = 0
        for val in self._vals:
            sysfeature = wx.SystemSettings.HasFeature(getattr(wx, val))

            # Draw label
            dc.DrawText(val, nextx, nexty)

            # Calculate box position
            nextx += self._maxw + 8
            dc.DrawText(repr(sysfeature), nextx, nexty)

            nextx = 10
            nexty += 20
Exemplo n.º 16
0
    def on_paint(self, evt):
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GraphicsContext.Create(dc)  # Anti-aliasing

        gc.SetPen(wx.Pen("blue", width=4))
        gc.SetBrush(wx.Brush("black"))
        w, h = self.ClientSize
        gc.DrawRectangle(0, 0, w, h)

        gc.SetPen(wx.Pen("gray", width=2))
        w, h = w - 10, h - 10
        gc.Translate(5, 5)
        gc.DrawEllipse(0, 0, w, h)
        gc.SetPen(wx.Pen("red", width=1))
        gc.SetBrush(wx.Brush("yellow"))
        gc.Translate(w * .5, h * .5)
        gc.Scale(w, h)
        rot = next(self.rotation_data)
        gc.Rotate(-rot)
        gc.Translate(.5, 0)
        gc.Rotate(rot)
        gc.Scale(1. / w, 1. / h)
        gc.DrawEllipse(-5, -5, 10, 10)
Exemplo n.º 17
0
 def on_paint(self, event):
     dc = wx.AutoBufferedPaintDCFactory(self)
     #dc.BeginDrawing()
     self.paint(dc)
Exemplo n.º 18
0
    def __DrawButtons(self):
        dc = wx.AutoBufferedPaintDCFactory(self)
        if wx.Platform == '__WXMSW__':
            dc.SetBackground(wx.Brush(self.GetParent().GetBackgroundColour()))
            dc.Clear()
        gc = wx.GCDC(dc)
        gc.SetBackgroundMode(wx.TRANSPARENT)
        gc.SetFont(self.GetFont())

        (w, h) = self.GetSize()  #DoGetBestSize()
        w -= (self._border * 2)
        h -= (self._border * 2)
        n_seg = len(self.segments)
        rgc = gc.GetGraphicsContext()
        if self._style & SEGBTN_VERTICAL:
            # XXX a smaller gradient looks better for vertical controls
            gradient_brush = rgc.CreateLinearGradientBrush(
                0, 0, w, 0, (240, 240, 240), (200, 200, 200))
        else:
            gradient_brush = rgc.CreateLinearGradientBrush(
                0, 0, 0, h, (250, 250, 250), (185, 185, 185))
        rgc.SetBrush(gradient_brush)
        border_pen = wx.Pen(self._border_color, 1)
        # XXX wx.GCDC on GTK draws thin black lines as thicker dark grey lines
        # due to antialiasing.
        if wx.Platform == '__WXGTK__':
            gc.SetPen(wx.TRANSPARENT_PEN)
            dc.SetPen(border_pen)
            dc.SetBrush(wx.TRANSPARENT_BRUSH)
        else:
            gc.SetPen(border_pen)
        if self._style & SEGBTN_ROUNDED_CORNERS:
            gc.DrawRoundedRectangle(self._border, self._border, w, h, 3)
            if wx.Platform == '__WXGTK__':
                dc.DrawRoundedRectangle(self._border, self._border, w, h, 3)
        else:
            gc.DrawRectangle(self._border, self._border, w, h)
            if wx.Platform == '__WXGTK__':
                dc.DrawRectangle(self._border, self._border, w, h)
        gc.SetPen(wx.TRANSPARENT_PEN)
        gc.SetBrush(wx.TRANSPARENT_BRUSH)
        if n_seg == 0:
            gc.SetTextForeground('red')
            gc.DrawText("XXX", self._padding, self._padding)
        else:
            gc.SetTextForeground('black')
            gc.SetPen(wx.Pen('black', 1))  #BLACK_PEN)
            buf = 1
            (txt_w, txt_h) = self.__OverallSegmentContentSize(gc)
            if self._style & SEGBTN_VERTICAL:
                seg_w = w - 2
                seg_h = ((h - 1) / n_seg) - buf
            else:
                seg_w = ((w - 1) / n_seg) - buf
                seg_h = h - 2
            current_x = 1 + self._border
            current_y = 1 + self._border
            for i, (label, bitmap) in enumerate(self.segments):
                gc.SetPen(border_pen)
                dc.SetPen(border_pen)
                (txt_x, txt_y) = (self._padding + 1, self._padding + 1)
                if self._style & SEGBTN_VERTICAL:
                    if i > 0:
                        dc.DrawLine(self._border, current_y,
                                    w + self._border - 1, current_y)
                        current_y += 1
                    txt_y += current_y
                    txt_x += self._border
                else:
                    if i > 0:
                        dc.DrawLine(current_x, self._border + 1, current_x,
                                    h + self._border - 1)
                        current_x += 1
                    txt_x += current_x
                    txt_y += self._border
                if ((self.HasCapture() and i == self._clicked_segment)
                        or self.values[i] == True):
                    xo = current_x + (seg_w / 2)
                    yo = current_y + (seg_h / 2)
                    radius = max(seg_w, seg_h) - 1
                    brush = rgc.CreateRadialGradientBrush(
                        xo, yo, xo, yo, radius, (220, 220, 220),
                        (120, 120, 120))
                    rgc.SetBrush(brush)
                    gc.SetPen(wx.TRANSPARENT_PEN)
                    if self._style & SEGBTN_ROUNDED_CORNERS and (i == 0 or i
                                                                 == n_seg):
                        gc.DrawRoundedRectangle(current_x, current_y, seg_w,
                                                seg_h, 1)
                    else:
                        gc.DrawRectangle(current_x, current_y, seg_w, seg_h)
                    #gc.DrawRectangle(current_x, current_y, total_w, total_h)
                rgc.SetBrush(gradient_brush)
                gc.SetBrush(wx.TRANSPARENT_BRUSH)
                gc.SetPen(wx.BLACK_PEN)
                label_w, label_h = gc.GetTextExtent(label)
                if bitmap is not None:
                    (img_w, img_h) = bitmap.GetSize()
                    img_x, img_y = txt_x, txt_y
                    if label != "":
                        if wx.Platform == '__WXGTK__':
                            img_y -= 4
                        extra_h_space = seg_w - img_w - (self._padding * 2)
                        extra_v_space = seg_w - img_h - label_h - (
                            self._padding * 2)
                    else:
                        extra_h_space = seg_w - img_w - (self._padding * 2)
                        extra_v_space = seg_h - img_h - (self._padding * 2)
                    if extra_h_space > 0:
                        img_x += extra_h_space / 2
                    if extra_v_space > 0:
                        img_y += extra_v_space / 2
                    gc.DrawBitmap(bitmap, img_x, img_y,
                                  bitmap.GetMask() != None)
                    txt_y += img_h
                    if (wx.Platform == '__WXMSW__'):
                        txt_y -= 2
                if label != "":
                    #print seg_w, label_w
                    extra_w = seg_w - label_w - (self._padding * 2)
                    if extra_w > 0:
                        txt_x += extra_w / 2
                    extra_h = seg_h - label_h - (self._padding * 2)
                    if extra_h > 0:
                        txt_y += extra_h / 2
                    gc.DrawText(label, txt_x, txt_y)
                if self._style & SEGBTN_VERTICAL:
                    current_y += seg_h
                else:
                    current_x += seg_w
Exemplo n.º 19
0
    def __DrawButton(self):
        """Draw the button"""
        dc = wx.AutoBufferedPaintDCFactory(self)
        gc = wx.GCDC(dc)

        # Setup
        dc.SetBrush(wx.WHITE_BRUSH)
        gc.SetBrush(wx.WHITE_BRUSH)
        gc.SetFont(self.GetFont())
        #gc.SetBackgroundMode(wx.TRANSPARENT)

        # Calc Object Positions
        width, height = self.GetSize()
        #get text dimensions from dc rather than gc as gc reports wrong height for empty strings on Windows
        tw, th = dc.GetTextExtent(self.GetLabel())
        if self._label2 != '':
            txt_y = 4  #th + 4 #height - th - 4
            txt2_y = th + 8
        else:
            txt_y = max((height - th) / 2 - 1, 1)
            txt2_y = None
        #print height, th, txt_y, txt2_y
        #gc.SetBrush(wx.TRANSPARENT_BRUSH)
        #gc.DrawRectangle(0, 0, width, height)
        gc.SetPen(wx.Pen((100, 100, 100)))
        gc.SetBrush(wx.Brush((240, 240, 240)))
        gc.DrawRectangle(0, 0, width, height)
        gc.SetPen(wx.TRANSPARENT_PEN)

        if self._state['cur'] == GRADIENT_HIGHLIGHT:
            gc.SetTextForeground(self._color['htxt'])
            self.__DrawHighlight(gc, width, height)

        elif self._state['cur'] == GRADIENT_PRESSED:
            gc.SetTextForeground(self._color['htxt'])
            if wx.Platform == '__WXMAC__':
                brush = wx.Brush((100, 100, 100))
                brush.MacSetTheme(Carbon.Appearance.kThemeBrushFocusHighlight)
                pen = wx.Pen(brush.GetColour(), 1, wx.SOLID)
            else:
                pen = wx.Pen(
                    AdjustColour(self._color['press_start'], -80, 220), 1)
            #gc.SetPen(pen)

            self.__DrawHighlight(gc, width, height)
            txt_x = self.__DrawBitmap(gc)
            gc.DrawText(self.GetLabel(), txt_x + 2, txt_y)
            self.__DrawCaption(gc, txt_x + 2, txt2_y)
            self.__DrawDropArrow(gc, width - 10, (height / 2) - 2)

        else:
            rgc = gc.GetGraphicsContext()
            #gc.SetPen(wx.TRANSPARENT_PEN)
            color = wx.Colour(218, 218, 218)
            brush = rgc.CreateLinearGradientBrush(
                0, 1, 0, height, self._color['gradient_start'],
                self._color['gradient_end'])
            rgc.SetBrush(brush)
            gc.DrawRectangle(1, 2, width - 2, height - 3)
            if self.IsEnabled():
                gc.SetTextForeground(self.GetForegroundColour())
            else:
                txt_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)
                gc.SetTextForeground(txt_c)

        # Draw bitmap and text
        if self._state['cur'] != GRADIENT_PRESSED:
            txt_x = self.__DrawBitmap(gc)
            gc.DrawText(self.GetLabel(), txt_x + 2, txt_y)
            self.__DrawCaption(gc, txt_x + 2, txt2_y)
Exemplo n.º 20
0
 def OnPaint(self, event):
     dc = wx.AutoBufferedPaintDCFactory(self)
     self.paint(dc)