I have been trying to create a working executable of a wx/Matplotlib
application
on Linux for quite a while with no luck.  When I try to build my
application with PyInstaller, I always get one of two errors, no
matter what I try.  These are the errors that I get

'Could not find the matplotlib data files'

and

File "testPlot/buildtestPlot/outPYZ3.pyz/numpy", line 16, in <module>
AttributeError: 'module' object has no attribute 'version'


Someone over at the wxPython mailing list directed me to their spec
file, but I can't seem to get that to work either.  Here is the link
to it:

http://code.google.com/p/devide/source/browse/trunk/devide/installer/devide.spec

I have found the workaround for this on Windows with py2exe.  However,
I cannot
seem to figure out how to fix this issue on Linux.  I have only
managed to find
one example of how to do this with Pyinstaller on the web, and it
doesn't work.  I've pretty much done everything that I know to do, but
still can't get it to work.  Has anyone figured this out?  If so,
could you please post how to build a very
simple wx/Matplotlib application such as the one found below?  I, and
I am sure
several others around here, would be very greatful!


#!/usr/bin/env python

#This code is from the "examples" folder that
#is shipped with Matplotlib

from numpy import arange, sin, pi
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from wx import *

class CanvasFrame(Frame):
    def __init__(self):
        Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350))
        self.SetBackgroundColour(NamedColor("WHITE"))
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        t = arange(0.0,3.0,0.01)
        s = sin(2*pi*t)
        self.axes.plot(t,s)
        self.canvas = FigureCanvas(self, -1, self.figure)
        self.sizer = BoxSizer(VERTICAL)
        self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW)
        self.SetSizerAndFit(self.sizer)
        self.add_toolbar()

    def add_toolbar(self):
        self.toolbar = NavigationToolbar2Wx(self.canvas)
        self.toolbar.Realize()
        if Platform == '__WXMAC__':
            self.SetToolBar(self.toolbar)
        else:
            tw, th = self.toolbar.GetSizeTuple()
            fw, fh = self.canvas.GetSizeTuple()
            self.toolbar.SetSize(Size(fw, th))
            self.sizer.Add(self.toolbar, 0, LEFT | EXPAND)
        self.toolbar.update()

    def OnPaint(self, event):
        self.canvas.draw()

class App(App):
    def OnInit(self):
        'Create the main window and insert the custom frame'
        frame = CanvasFrame()
        frame.Show(True)
        return True

app = App(0)
app.MainLoop()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to