wxPython wx.lib.plot.PlotCanvas错误

Leo*_*Leo 9 python wxpython

我正在制作一个非常简单的策划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()
Run Code Online (Sandbox Code Playgroud)

但是,每当我测试它时,它都会抛出这个错误:

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
Run Code Online (Sandbox Code Playgroud)

我传递了wx文档所说的所有参数.我究竟做错了什么?

tho*_*r18 2

虽然这是 wx 版本的问题,但我测试了您的代码,并且 wx 'classic' 和 wx 'phoenix'3.0.2的源代码中不存在此问题。 3.0.33.0.3

3.0.3您可以从以下来源签出/构建/安装“经典”的存储库:
https://github.com/wxWidgets/wxWidgets.git
https://github.com/wxWidgets/wxPython.git
签出后的方向将在wxPython/docs/BUILD.txt

或者,使用以下源在您的项目中使用“phoenix” 3.0.3: https:
//github.com/wxWidgets/Phoenix.git
结帐后的方向将在wxPython/README.rst