+ xy = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1]))
+ Canvas.AddText(String, xy, Size = ts, Color = colors[cf], Position = "cc")
+
+ # Scaled Text
+ String = "Scaled text"
+ for i in range(3):
+ ts = random.random()*3 + 0.2
+ cf = random.randint(0,len(colors)-1)
+ Point = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1]))
+ Canvas.AddScaledText(String, Point, Size = ts, Color = colors[cf], Position = "cc")
+
+ # Arrows
+ N = 5
+ Points = RandomArray.uniform(Range[0], Range[1], (N,2) )
+ for i in range(N):
+ Canvas.AddArrow(Points[i],
+ random.uniform(20,100),
+ Direction = random.uniform(0,360),
+ LineWidth = random.uniform(1,5),
+ LineColor = colors[random.randint(0,len(colors)-1)],
+ ArrowHeadAngle = random.uniform(20,90))
+
+ # ArrowLines
+ for i in range(5):
+ points = []
+ for j in range(random.randint(2,10)):
+ point = (random.randint(Range[0],Range[1]),random.randint(Range[0],Range[1]))
+ points.append(point)
+ lw = random.randint(1,10)
+ cf = random.randint(0,len(colors)-1)
+ cl = random.randint(0,len(colors)-1)
+ Canvas.AddArrowLine(points, LineWidth = lw, LineColor = colors[cl], ArrowHeadSize= 16)
+
+
+ Canvas.ZoomToBB()
+
+ def TestAnimation(self,event=None):
+ """
+
+ In this test, a relatively complex background is drawn, and
+ a simple object placed in the foreground is moved over
+ it. This demonstrates how to use the InForeground attribute
+ to make an object in the foregorund draw fast, without
+ having to re-draw the whole background.
+
+ """
+ wx.GetApp().Yield(True)
+ Range = (-10,10)
+ self.Range = Range
+
+ self.UnBindAllMouseEvents()
+ Canvas = self.Canvas
+ Canvas.InitAll()
+
+ ## Random tests of everything:
+ colors = self.colors
+ # Rectangles
+ for i in range(3):
+ xy = (random.uniform(Range[0],Range[1]), random.uniform(Range[0],Range[1]))
+ lw = random.randint(1,5)
+ cf = random.randint(0,len(colors)-1)
+ wh = (random.randint(1,5), random.randint(1,5) )
+ Canvas.AddRectangle(xy, wh, LineWidth = lw, FillColor = colors[cf])
+
+ # Ellipses
+ for i in range(3):
+ xy = (random.uniform(Range[0],Range[1]), random.uniform(Range[0],Range[1]))
+ lw = random.randint(1,5)
+ cf = random.randint(0,len(colors)-1)
+ wh = (random.randint(1,5), random.randint(1,5) )
+ Canvas.AddEllipse(xy, wh, LineWidth = lw, FillColor = colors[cf])
+
+ # Circles
+ for i in range(5):
+ xy = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1]))
+ D = random.randint(1,5)
+ lw = random.randint(1,5)
+ cf = random.randint(0,len(colors)-1)
+ cl = random.randint(0,len(colors)-1)
+ Canvas.AddCircle(xy, D, LineWidth = lw, LineColor = colors[cl], FillColor = colors[cf])
+ Canvas.AddText("Circle # %i"%(i), xy, Size = 12, BackgroundColor = None, Position = "cc")
+
+ # Lines
+ for i in range(5):
+ points = []
+ for j in range(random.randint(2,10)):
+ point = (random.randint(Range[0],Range[1]),random.randint(Range[0],Range[1]))
+ points.append(point)
+ lw = random.randint(1,10)
+ cf = random.randint(0,len(colors)-1)
+ cl = random.randint(0,len(colors)-1)
+ Canvas.AddLine(points, LineWidth = lw, LineColor = colors[cl])
+
+ # Polygons
+ for i in range(3):
+ points = []
+ for j in range(random.randint(2,6)):
+ point = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1]))
+ points.append(point)
+ lw = random.randint(1,6)
+ cf = random.randint(0,len(colors)-1)
+ cl = random.randint(0,len(colors)-1)
+ Canvas.AddPolygon(points,
+ LineWidth = lw,
+ LineColor = colors[cl],
+ FillColor = colors[cf],
+ FillStyle = 'Solid')
+
+ # Scaled Text
+ String = "Scaled text"
+ for i in range(3):
+ ts = random.random()*3 + 0.2
+ cf = random.randint(0,len(colors)-1)
+ xy = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1]))
+ Canvas.AddScaledText(String, xy, Size = ts, Color = colors[cf], Position = "cc")
+
+
+ # Now the Foreground Object:
+ C = Canvas.AddCircle((0,0), 7, LineWidth = 2,LineColor = "Black",FillColor = "Red", InForeground = True)
+ T = Canvas.AddScaledText("Click to Move", (0,0), Size = 0.6, Position = 'cc', InForeground = True)
+ C.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.MoveMe)
+ C.Text = T
+
+ self.Timer = wx.PyTimer(self.ShowFrame)
+ self.FrameDelay = 50 # milliseconds
+
+ Canvas.ZoomToBB()
+
+ def ShowFrame(self):
+ Object = self.MovingObject
+ Range = self.Range
+ if self.TimeStep < self.NumTimeSteps:
+ x,y = Object.XY
+ if x > Range[1] or x < Range[0]:
+ self.dx = -self.dx
+ if y > Range[1] or y < Range[0]:
+ self.dy = -self.dy
+ Object.Move( (self.dx,self.dy) )
+ Object.Text.Move( (self.dx,self.dy))
+ self.Canvas.Draw()
+ self.TimeStep += 1
+ wx.GetApp().Yield(True)
+ else:
+ self.Timer.Stop()
+
+
+ def MoveMe(self, Object):
+ self.MovingObject = Object
+ Range = self.Range
+ self.dx = random.uniform(Range[0]/4,Range[1]/4)
+ self.dy = random.uniform(Range[0]/4,Range[1]/4)
+ #import time
+ #start = time.time()
+ self.NumTimeSteps = 200
+ self.TimeStep = 1
+ self.Timer.Start(self.FrameDelay)
+ #print "Did %i frames in %f seconds"%(N, (time.time() - start) )
+
+ def TestHitTest(self, event=None):
+ wx.GetApp().Yield(True)
+
+ self.UnBindAllMouseEvents()
+ Canvas = self.Canvas
+
+ Canvas.InitAll()
+
+ #Add a Hit-able rectangle
+ w, h = 60, 20
+
+ dx = 80
+ dy = 40
+ x, y = 20, 20
+ FontSize = 10
+
+ #Add one that is not HitAble
+ Canvas.AddRectangle((x,y), (w, h), LineWidth = 2)
+ Canvas.AddText("Not Hit-able", (x,y), Size = FontSize, Position = "bl")
+
+
+ x += dx
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2)
+ R.Name = "Line Rectangle"
+ R.HitFill = False
+ R.HitLineWidth = 5 # Makes it a little easier to hit
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHit)
+ Canvas.AddText("Left Click Line", (x,y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "Red"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + "Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHit)
+ Canvas.AddText("Left Click Fill", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ color = "LightBlue"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_DOWN, self.RectGotHit)
+ Canvas.AddText("Right Click Fill", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "Grey"
+ R = Canvas.AddEllipse((x, y), (w, h),LineWidth = 2,FillColor = color)
+ R.Name = color +" Ellipse"
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_DOWN, self.RectGotHit)
+ Canvas.AddText("Right Click Fill", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "Brown"
+ R = Canvas.AddCircle((x+dx/2, y+dy/2), dx/4, LineWidth = 2, FillColor = color)
+ R.Name = color + " Circle"
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DCLICK, self.RectGotHit)
+ Canvas.AddText("Left D-Click Fill", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ color = "Pink"
+ R = Canvas.AddCircle((x+dx/2, y+dy/2), dx/4, LineWidth = 2,FillColor = color)
+ R.Name = color + " Circle"
+ R.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.RectGotHit)
+ Canvas.AddText("Left Up Fill", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "White"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_MIDDLE_DOWN, self.RectGotHit)
+ Canvas.AddText("Middle Down", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "AQUAMARINE"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_MIDDLE_UP, self.RectGotHit)
+ Canvas.AddText("Middle Up", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ color = "CORAL"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_MIDDLE_DCLICK, self.RectGotHit)
+ Canvas.AddText("Middle DoubleClick", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "CYAN"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_UP, self.RectGotHit)
+ Canvas.AddText("Right Up", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "LIME GREEN"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_DCLICK, self.RectGotHit)
+ Canvas.AddText("Right Double Click", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ color = "MEDIUM GOLDENROD"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_DOWN, self.RectGotHitRight)
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHitLeft)
+ Canvas.AddText("L and R Click", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "SALMON"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color + " Rectangle"
+ R.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.RectMouseOver)
+ Canvas.AddText("Mouse Enter", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "MEDIUM VIOLET RED"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color
+ R.Bind(FloatCanvas.EVT_FC_LEAVE_OBJECT, self.RectMouseLeave)
+ Canvas.AddText("Mouse Leave", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ color = "SKY BLUE"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color)
+ R.Name = color
+ R.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.RectMouseOver)
+ R.Bind(FloatCanvas.EVT_FC_LEAVE_OBJECT, self.RectMouseLeave)
+ Canvas.AddText("Enter and Leave", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "WHEAT"
+ R = Canvas.AddRectangle((x, y), (w+12, h), LineColor = None, FillColor = color)
+ R.Name = color
+ R.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.RectMouseOver)
+ R.Bind(FloatCanvas.EVT_FC_LEAVE_OBJECT, self.RectMouseLeave)
+ Canvas.AddText("Mouse Enter&Leave", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "KHAKI"
+ R = Canvas.AddRectangle((x-12, y), (w+12, h), LineColor = None, FillColor = color)
+ R.Name = color
+ R.Bind(FloatCanvas.EVT_FC_ENTER_OBJECT, self.RectMouseOver)
+ R.Bind(FloatCanvas.EVT_FC_LEAVE_OBJECT, self.RectMouseLeave)
+ Canvas.AddText("Mouse Enter&Leave", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ L = Canvas.AddLine(( (x, y), (x+10, y+10), (x+w, y+h) ), LineWidth = 2, LineColor = "Red")
+ L.Name = "A Line"
+ L.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHitLeft)
+ Canvas.AddText("Left Down", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(L.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "SEA GREEN"
+ Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float_)
+ R = Canvas.AddPolygon(Points, LineWidth = 2, FillColor = color)
+ R.Name = color + " Polygon"
+ R.Bind(FloatCanvas.EVT_FC_RIGHT_DOWN, self.RectGotHitRight)
+ Canvas.AddText("RIGHT_DOWN", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "Red"
+ Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float_)
+ R = Canvas.AddPointSet(Points, Diameter = 4, Color = color)
+ R.Name = "PointSet"
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.PointSetGotHit)
+ Canvas.AddText("LEFT_DOWN", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Size = FontSize, Position = "tl")
+
+ x = 20
+ y += dy
+ T = Canvas.AddText("Hit-able Text", (x, y), Size = 15, Color = "Red", Position = 'tl')
+ T.Name = "Hit-able Text"
+ T.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHitLeft)
+ Canvas.AddText("Left Down", (x, y), Size = FontSize, Position = "bl")
+
+ x += dx
+ T = Canvas.AddScaledText("Scaled Text", (x, y), Size = 1./2*h, Color = "Pink", Position = 'bl')
+ Canvas.AddPointSet( (x, y), Diameter = 3)
+ T.Name = "Scaled Text"
+ T.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHitLeft)
+ Canvas.AddText("Left Down", (x, y), Size = FontSize, Position = "tl")
+
+ x += dx
+ color = "Cyan"
+ Point = (x + w/2, y)
+ #Points = N.array(( (x, y), (x, y+2.*h/3), (x+w, y+h), (x+w, y+h/2.), (x + 2.*w/3, y+h/2.), (x + 2.*w/3,y) ), N.float_)
+ R = Canvas.AddSquarePoint(Point, Size = 8, Color = color)
+ R.Name = "SquarePoint"
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHit)
+ Canvas.AddText("LEFT_DOWN", (x, y), Size = FontSize, Position = "bl")
+ Canvas.AddText(R.Name, (x, y), Size = FontSize, Position = "tl")
+
+
+ self.Canvas.ZoomToBB()
+
+ def TestHitTestForeground(self,event=None):
+ wx.GetApp().Yield(True)
+
+ self.UnBindAllMouseEvents()
+ Canvas = self.Canvas
+
+ Canvas.InitAll()
+
+ #Add a Hitable rectangle
+ w, h = 60, 20
+
+ dx = 80
+ dy = 40
+ x,y = 20, 20
+
+ color = "Red"
+ R = Canvas.AddRectangle((x, y), (w, h), LineWidth = 2, FillColor = color, InForeground = False)
+ R.Name = color + "Rectangle"
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectGotHit)
+ Canvas.AddText("Left Click Fill", (x, y), Position = "bl")
+ Canvas.AddText(R.Name, (x, y+h), Position = "tl")
+
+ ## A set of Rectangles that move together
+
+ ## NOTE: In a real app, it might be better to create a new
+ ## custom FloatCanvas DrawObject
+
+ self.MovingRects = []
+ WH = (w/2, h/2)
+ x += dx
+ color = "LightBlue"
+ R = Canvas.AddRectangle((x, y), WH, LineWidth = 2, FillColor = color, InForeground = True)
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectMoveLeft)
+ L = Canvas.AddText("Left", (x + w/4, y + h/4), Position = "cc", InForeground = True)
+ self.MovingRects.extend( (R,L) )
+
+ x += w/2
+ R = Canvas.AddRectangle((x, y), WH, LineWidth = 2, FillColor = color, InForeground = True)
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectMoveRight)
+ L = Canvas.AddText("Right", (x + w/4, y + h/4), Position = "cc", InForeground = True)
+ self.MovingRects.extend( (R,L) )
+
+ x -= w/2
+ y += h/2
+ R = Canvas.AddRectangle((x, y), WH, LineWidth = 2, FillColor = color, InForeground = True)
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectMoveUp)
+ L = Canvas.AddText("Up", (x + w/4, y + h/4), Position = "cc", InForeground = True)
+ self.MovingRects.extend( (R,L) )
+
+
+ x += w/2
+ R = Canvas.AddRectangle((x, y), WH, LineWidth = 2, FillColor = color, InForeground = True)
+ R.HitFill = True
+ R.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.RectMoveDown)
+ L = Canvas.AddText("Down", (x + w/4, y + h/4), Position = "cc", InForeground = True)
+ self.MovingRects.extend( (R,L) )
+
+ self.Canvas.ZoomToBB()
+
+ def RectMoveLeft(self,Object):
+ self.MoveRects("left")
+
+ def RectMoveRight(self,Object):
+ self.MoveRects("right")
+
+ def RectMoveUp(self,Object):
+ self.MoveRects("up")
+
+ def RectMoveDown(self,Object):
+ self.MoveRects("down")
+
+ def MoveRects(self, Dir):
+ for Object in self.MovingRects:
+ X,Y = Object.XY
+ if Dir == "left": X -= 10
+ elif Dir == "right": X += 10
+ elif Dir == "up": Y += 10
+ elif Dir == "down": Y -= 10
+ Object.SetPoint((X,Y))
+ self.Canvas.Draw()
+
+ def PointSetGotHit(self, Object):
+ self.Log(Object.Name + "Got Hit\n")
+
+ def RectGotHit(self, Object):
+ self.Log(Object.Name + "Got Hit\n")
+
+ def RectGotHitRight(self, Object):
+ self.Log(Object.Name + "Got Hit With Right\n")
+
+ def RectGotHitLeft(self, Object):
+ self.Log(Object.Name + "Got Hit with Left\n")
+
+ def RectMouseOver(self, Object):
+ self.Log("Mouse entered:" + Object.Name)
+
+ def RectMouseLeave(self, Object):
+ self.Log("Mouse left " + Object.Name)
+
+
+ def TestText(self, event= None):
+ wx.GetApp().Yield(True)
+
+ self.BindAllMouseEvents()
+ Canvas = self.Canvas
+ Canvas.InitAll()
+
+
+ DefaultSize = 12
+ Point = (3, 0)
+
+ ## Add a non-visible rectangle, just to get a Bounding Box
+ ## Text objects have a zero-size bounding box, because it changes with zoom
+ Canvas.AddRectangle((-10,-10),
+ (20,20),
+ LineWidth = 1,
+ LineColor = None)
+
+ # Text
+ String = "Some text"
+ self.Canvas.AddText("Top Left",Point,Size = DefaultSize,Color = "Yellow",BackgroundColor = "Blue", Position = "tl")
+ self.Canvas.AddText("Bottom Left",Point,Size = DefaultSize,Color = "Cyan",BackgroundColor = "Black",Position = "bl")
+ self.Canvas.AddText("Top Right",Point,Size = DefaultSize,Color = "Black",BackgroundColor = "Cyan",Position = "tr")
+ self.Canvas.AddText("Bottom Right",Point,Size = DefaultSize,Color = "Blue",BackgroundColor = "Yellow",Position = "br")
+ Canvas.AddPointSet((Point), Color = "White", Diameter = 2)
+
+ Point = (3, 2)
+
+ Canvas.AddPointSet((Point), Color = "White", Diameter = 2)
+ self.Canvas.AddText("Top Center",Point,Size = DefaultSize,Color = "Black",Position = "tc")
+ self.Canvas.AddText("Bottom Center",Point,Size = DefaultSize,Color = "White",Position = "bc")
+
+ Point = (3, 4)
+
+ Canvas.AddPointSet((Point), Color = "White", Diameter = 2)
+ self.Canvas.AddText("Center Right",Point,Size = DefaultSize,Color = "Black",Position = "cr")
+ self.Canvas.AddText("Center Left",Point,Size = DefaultSize,Color = "Black",Position = "cl")
+
+ Point = (3, -2)
+
+ Canvas.AddPointSet((Point), Color = "White", Diameter = 2)
+ self.Canvas.AddText("Center Center",
+ Point, Size = DefaultSize,
+ Color = "Black",
+ Position = "cc")
+
+ self.Canvas.AddText("40 Pixels", (-10,8), Size = 40)
+ self.Canvas.AddText("20 Pixels", (-10,5), Size = 20)
+ self.Canvas.AddText("10 Pixels", (-10,3), Size = 10)
+
+ self.Canvas.AddText("MODERN Font", (-10, 0), Family = wx.MODERN)
+ self.Canvas.AddText("DECORATIVE Font", (-10, -1), Family = wx.DECORATIVE)
+ self.Canvas.AddText("ROMAN Font", (-10, -2), Family = wx.ROMAN)
+ self.Canvas.AddText("SCRIPT Font", (-10, -3), Family = wx.SCRIPT)
+ self.Canvas.AddText("ROMAN BOLD Font", (-10, -4), Family = wx.ROMAN, Weight=wx.BOLD)
+ self.Canvas.AddText("ROMAN ITALIC BOLD Font", (-10, -5), Family = wx.ROMAN, Weight=wx.BOLD, Style=wx.ITALIC)
+
+ # NOTE: this font exists on my Linux box..who knows were else you'll find it!
+ Font = wx.Font(20, wx.DEFAULT, wx.ITALIC, wx.NORMAL, False, "helvetica")
+ self.Canvas.AddText("Helvetica Italic", (-10, -6), Font = Font)
+