]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/test_gc.py
   3 class TestPanel(wx
.Panel
): 
   4     def __init__(self
, *args
, **kw
): 
   5         wx
.Panel
.__init
__(self
, *args
, **kw
) 
   6         self
.Bind(wx
.EVT_PAINT
, self
.OnPaint
) 
   8     def OnPaint(self
, evt
): 
   9         gc 
= wx
.GraphicsContext
.Create(wx
.PaintDC(self
)) 
  11         pen 
= wx
.Pen("navy", 2) 
  13         brush 
= wx
.Brush((255,32,32,128)) 
  17         path 
= gc
.CreatePath() 
  18         path
.MoveToPoint(50, 50) 
  19         path
.AddLineToPoint(25,25) 
  20         path
.AddLineToPoint(50,25) 
  21         path
.AddLineToPoint(50,50) 
  36         brush 
= wx
.Brush((32,32,255,128)) 
  45         points 
= [ (5.2, 5.9), 
  49                    wx
.Point2D(20.5,50.9), 
  57         gc
.StrokeLines(points
) 
  76         # in a floating point coordinate system the center of the 
  77         # pixel is actually at x+0.5, y+0.5, so with anti-aliasing 
  78         # turned on we'll get a crisper line by positioning our line 
  79         # segments at the 0.5 offset.  For this test we'll just let 
  80         # the GC do the translation for us. 
  81         gc
.Translate(0.5, 0.5) 
  83         pen 
= wx
.Pen("purple", 1) 
  87         gc
.StrokeLineSegements(begin
, end
) 
  91         gc
.StrokeLineSegements(begin
, end
)