【发布时间】:2014-01-27 10:04:05
【问题描述】:
我的程序给了我这个错误:
Traceback (most recent call last):
File "C:\Simulation\SymDialog.py", line 153, in OnPaint
self.Redraw(False)
File "C:\Simulation\SymDialog.py", line 173, in Redraw
obj.Draw(self.dc)
File "C:\Simulation\SymDialog.py", line 207, in Draw
dc.DrawCircle(self._x, self._y, self._r)
File "E:\Python\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 3391, in DrawCircle
return _gdi_.DC_DrawCircle(*args, **kwargs)
OverflowError: Python int too large to convert to C long
来自错误的方法:
OnPaint
def OnPaint(self, event):
self.Redraw(False)
wx.GCDC(wx.BufferedPaintDC(self, self._buffer))
event.Skip()
重绘
def Redraw(self, clear):
if clear == True: del self.drawList[:]
self.dc = wx.GCDC(wx.BufferedDC(None, self._buffer))
self.dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
self.dc.Clear()
for obj in self.drawList:
obj.Draw(self.dc)
del self.dc
画
def Draw(self, dc):
self.setDC(dc)
dc.DrawCircle(self._x, self._y, self._r)
我该如何解决这个错误? 谢谢解答
【问题讨论】:
-
停止尝试使用太大的值。
-
DrawCircle 需要一些参数,但您传递的值太大。尝试传递较小的值。
-
但是“self._x,self._y”的值不是太大,在(0, 600)范围内,因为这是画圆的panel的大小。跨度>