X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5ed3dab2615f9d2214c8e452daf844d65620cbbb..1fc25a89ac1e6c5208db24bfc0abc8666b791dc6:/utils/wxPython/demo/wxScrolledWindow.py?ds=inline diff --git a/utils/wxPython/demo/wxScrolledWindow.py b/utils/wxPython/demo/wxScrolledWindow.py index 9cd5bea955..44b5f9fd93 100644 --- a/utils/wxPython/demo/wxScrolledWindow.py +++ b/utils/wxPython/demo/wxScrolledWindow.py @@ -67,10 +67,25 @@ class MyCanvas(wxScrolledWindow): dc.SetTextForeground(wxColour(0, 0xFF, 0x80)) dc.DrawText("a bitmap", 200, 85) + font = wxFont(20, wxSWISS, wxNORMAL, wxNORMAL) + dc.SetFont(font) + dc.SetTextForeground(wxBLACK) + for a in range(0, 360, 45): + dc.DrawRotatedText("Rotated text...", 300, 300, a) + + dc.SetPen(wxTRANSPARENT_PEN) + dc.SetBrush(wxBLUE_BRUSH) + dc.DrawRectangle(50,500,50,50) + dc.DrawRectangle(100,500,50,50) + + #from wxPython import dch + #dch.FillRect(dc, wxRect(50, 400, 50, 50), wxBLACK) + self.DrawSavedLines(dc) dc.EndDrawing() + def DrawSavedLines(self, dc): dc.SetPen(wxPen(wxNamedColour('MEDIUM FOREST GREEN'), 4)) for line in self.lines: @@ -91,8 +106,10 @@ class MyCanvas(wxScrolledWindow): if event.LeftDown(): self.SetXY(event) self.curLine = [] + self.CaptureMouse() elif event.Dragging(): + print event.GetPosition() dc = wxClientDC(self) self.PrepareDC(dc) dc.BeginDrawing() @@ -106,6 +123,7 @@ class MyCanvas(wxScrolledWindow): elif event.LeftUp(): self.lines.append(self.curLine) self.curLine = [] + self.ReleaseMouse() #---------------------------------------------------------------------------