簡體   English   中英

Python錯誤-OverflowError:Python int太大,無法轉換為C long

[英]Python error - OverflowError: Python int too large to convert to C long

我的程序給我這個錯誤:

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

錯誤的方法:

上畫

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)

如何解決此錯誤? 謝謝答案

您可能錯誤地使用了太大的值。

編輯:由於我無法發表評論,self._x,self._y和self._r的大小是多少?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM