我正在绘制一个非常简单的wxApp。
我已经安装了Python 2.7.9和wxPython 3.0.2
这是我的代码:
import wx
import wx.lib.plot as plot
class Pantalla(wx.Frame):
def __init__(self):
app = wx.App()
self.frame1 = wx.Frame(None, title = "GRAFICADOR", id = -1, size=(500,500))
self.panel1 = wx.Panel(self.frame1)
self.panel1.SetBackgroundColour("white")
plotter = plot.PlotCanvas(self.panel1, id=-1, pos = wx.Point(-1,-1), size = wx.Size(-1,-1), style = 0, name= 'plotCanvas')
data = [(1,2), (2,3), (4,6)]
line = plot.PolyLine(data, colour='red', width = 1)
gc = plot.PlotGraphics([line], 'Line', 'Eje x', 'Eje y')
plotter.Draw(gc, xAxis = (0,15), yAxis=(0,15))
self.frame1.Show(True)
app.MainLoop()
t = Pantalla()
但是,每当我对其进行测试时,都会引发此错误:
Traceback (most recent call last):
File "<pyshell#26>", line 1, in <module>
f = Pantalla()
File "<pyshell#25>", line 7, in __init__
plotter = plot.PlotCanvas(self.panel1, id=-1, pos = wx.Point(-1,-1), size = wx.Size(-1,-1), style = 0, name= 'plotCanvas')
File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\lib\plot.py", line 598, in __init__
self.HandCursor = wx.Cursor(Hand.GetImage())
File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_gdi.py", line 1547, in __init__
_gdi_.Cursor_swiginit(self,_gdi_.new_Cursor(*args, **kwargs))
TypeError: Required argument 'type' (pos 2) not found
我传递了wx文档中所说的所有参数。我究竟做错了什么?
尽管这是wx3.0.2
发行版的问题,但我测试了您的代码,并且wx'classic 3.0.3
'或wx'phoenix 3.0.3
'的源代码中都不存在此问题。
您可以检出/编译/安装的回购3.0.3
从这些来源“经典”:
https://github.com/wxWidgets/wxWidgets.git
https://github.com/wxWidgets/wxPython.git
结账后,路线将在wxPython/docs/BUILD.txt
或者,3.0.3
通过以下来源在项目中使用“ phoenix” :
https : //github.com/wxWidgets/Phoenix.git
结帐后的指示将在wxPython/README.rst
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句