コード例 #1
0
ファイル: canvasObject.py プロジェクト: fvpolpeta/devide
 def __init__(self, position):
     # call parent ctor
     canvasSubject.__init__(self)
     
     self._position = position
     self._canvas = None
     self._observers = {'enter' : [],
                        'exit' : [],
                        'drag' : [],
                        'buttonDown' : [],
                        'buttonUp' : [],
                        'buttonDClick' : [],
                        'motion' : []}
コード例 #2
0
ファイル: canvas.py プロジェクト: fvpolpeta/devide
    def __init__(self, parent, id = -1, size = wx.wxDefaultSize):
        # parent 1 ctor
        wx.wxScrolledWindow.__init__(self, parent, id, wx.wxPoint(0, 0), size,
                                    wx.wxSUNKEN_BORDER)
        # parent 2 ctor
        canvasSubject.__init__(self)

        self._cobjects = []
        self._previousRealCoords = None
        self._mouseDelta = (0,0)
        self._potentiallyDraggedObject = None
        self._draggedObject = None

        self._observers = {'drag' : [],
                           'buttonDown' : [],
                           'buttonUp' : []}

        self.SetBackgroundColour("WHITE")

        wx.EVT_MOUSE_EVENTS(self, self.OnMouseEvent)
        wx.EVT_PAINT(self, self.OnPaint)

        self.virtualWidth = 2048
        self.virtualHeight = 2048
        
        self._buffer = None
        self._buffer = wx.wxEmptyBitmap(self.virtualWidth, self.virtualHeight)

        # we're only going to draw into the buffer, so no real client DC
        dc = wx.wxBufferedDC(None, self._buffer)
        dc.SetBackground(wx.wxBrush(self.GetBackgroundColour()))
        dc.Clear()
        self.doDrawing(dc)

        self.SetVirtualSize((self.virtualWidth, self.virtualHeight))
        self.SetScrollRate(20,20)