【问题标题】:wxPython wx.lib.plot.PlotCanvas errorwxPython wx.lib.plot.PlotCanvas 错误
【发布时间】:2015-08-03 17:08:36
【问题描述】:

我正在制作一个非常简单的绘图 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 文档中所说的所有参数。 我究竟做错了什么?

【问题讨论】:

标签: python wxpython


【解决方案1】:

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

您可以从以下来源签出/构建/安装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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2011-07-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多