here is a small sample that demonstrates some errors in the GCDC code.
As you slide the slider… the EllipticArc becomes thiner but the point where it begins is not what I indicated (it appears that it becomes horizontally shorter too)
If you comment out the GCDC wrapper the EllipticArc behaves as expected.
import wx
class Canvas(wx.Panel):
def init(self, parent):
wx.Panel.init(self, parent)
self.Bind
(wx.EVT_PAINT, self.OnPaint)
self.bkg_brush = wx.Brush((190,190,255))
self.v_pos = 100
def OnPaint(self, evt):
dc = wx.PaintDC(self)
dc = wx.GCDC(dc)
dc.SetBackground(self.bkg_brush)
dc.Clear()
dc.DrawEllipticArc(100, 200, 200, 150-self.v_pos, 90,270)
dc.DrawLine(100, 100, 100, 300)
class MyFrame(wx.Frame):
def init(self):
wx.Frame.__init__(self, None, title="OffestError")
self.SetSize((640,480))
self.canvas = Canvas(self)
self.slider = wx.Slider(self, minValue=0, maxValue=47)
box = wx.BoxSizer(wx.VERTICAL)
box.Add(self.canvas, 1, wx.EXPAND)
box.Add(self.slider, 0, wx.EXPAND)
self.SetSizer(box)
self.Show()
self.CenterOnScreen()
self.slider.Bind
(wx.EVT_SLIDER, self.OnSlide)
def OnSlide(self, evt):
self.canvas.v_pos = 100+self.slider.GetValue()
self.canvas.Refresh(False)
if name == “main”:
app = wx.App(0)
frame = MyFrame()
app.MainLoop()
···
–
There is NO FATE, we are the creators.