Python错误 - OverflowError:Python int太大而无法转换为C long

时间:2014-01-27 01:13:04

标签: python overflow

我的程序给了我这个错误:

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)

如何修复此错误? 谢谢你的回答

1 个答案:

答案 0 :(得分:0)

您可能错误地使用了太大的值。

编辑:由于我无法发表评论,self._x,self._y和self._r的大小是多少?