Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxPython wx.lib.plot.PlotCanvas error

I'm making a very straightforward plotting wxApp.

I've installed Python 2.7.9 and wxPython 3.0.2

Here is my code:

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()

However, whenever I test it, it throws me this error:

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

I'm passing all parameters that the documentation of wx says. What am I doing wrong?

like image 650
Leo Avatar asked May 21 '15 20:05

Leo


Video Answer


1 Answers

Though this is an issue with wx 3.0.2 release, I tested your code and this issue does not exist in source for wx 3.0.3 'classic' nor with wx 3.0.3 'phoenix'.

You can checkout/build/install the repos for 3.0.3 'classic' from these sources:
https://github.com/wxWidgets/wxWidgets.git
https://github.com/wxWidgets/wxPython.git
Directions after checkout will be in wxPython/docs/BUILD.txt

Alternatively, use the 'phoenix' 3.0.3 with your project using this source:
https://github.com/wxWidgets/Phoenix.git
Directions after checkout will be in wxPython/README.rst

like image 176
thorr18 Avatar answered Oct 14 '22 07:10

thorr18