All,
I don't understand why dc.DrawPolygon(points) and region = wx.RegionFromPoints(points) seem to occupy two different regions in the plane.
Help!
D.
import wx
from math import hypot, sin, cos, pi
class Star(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(350, 300))
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Center()
self.Show()
def OnPaint(self, event):
dc = wx.PaintDC(self)
dc.SetPen(wx.Pen('#424242'))
size_x, size_y = self.GetClientSizeTuple()
dc.SetDeviceOrigin(size_x / 2, size_y / 2)
points = (((0, 85), (75, 75), (100, 10), (125, 75), (200, 85),
(150, 125), (160, 190), (100, 150), (40, 190), (50, 125)))
dc.DrawPolygon(points)
region = wx.RegionFromPoints(points)
dc.SetClippingRegionAsRegion(region)
radius = hypot(size_x / 2, size_y / 2)
angle = 0
while (angle < 2 * pi):
x = radius * cos(angle)
y = radius * sin(angle)
dc.DrawLinePoint((0, 0), (x, y))
angle += pi / 180
dc.DestroyClippingRegion()
app = wx.App(False)
Star(None, -1, 'Star')
app.MainLoop()
···
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en