No renderer '1' found for mode '1'

Zeichnen

import wx

class MyPanel(wx.Panel):
    def __init__(self):
        wx.Panel.__init__(self, None, -1)
        
        self.Bind(wx.EVT_SIZE, self._onSize)
        self.Bind(wx.EVT_PAINT, self._onPaint)
        
        self._onSize()
        
    def _onSize(self, event = None):
        w, h = self.GetClientSize()
        self._buffer = wx.EmptyBitmap(w, h)
        
        dc = wx.MemoryDC()
        dc.SelectObject(self._buffer)
        
        self._draw(dc)
        
        del dc
        
        self.Refresh(eraseBackground = False)
        self.Update()
    
    def _onPaint(self, event):
        wx.BufferedPaintDC(self, self._buffer, wx.BUFFER_VIRTUAL_AREA)
       
    def _draw(self, dc):
        # draw on dc ...

  • Zuletzt geändert: 2019-03-31 13:26