[WARNING : A/V UNSCANNABLE] RE: wxPython and ReportLab

tried the mmap module? this may speed up access

···

-----Original Message-----
From: jdbolt@wordescapes.co.uk [mailto:jdbolt@wordescapes.co.uk]
Sent: Wednesday, July 06, 2005 20:31
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] wxPython and ReportLab

Hi, I am currently working to develop an application which creates a graph
from a .dat file, then displays the image of the graph within the frame.

So far I have achieved this but the trouble is the graph that is displayed
is first saved to disk, then it is read in as an image and displayed.
Obviously this is time consuming as I have to write to disk then read it
back, plus it raises security issues.

I wish to write the image to memory and display it, and I have no idea how
to do this. Is there a way to convert a ScatterLine() object to a
wxStaticImage, or wxAnything?

I would really appeciate anyones help, unfortunately I have to use
reportlab, cant budge on that :), so there must be a way to write the
graph to memory instead of to the hard disk and then read it back in as an
image.

Thanks, Jon

CODE:

To write the file I use:

ScatterLines().save(formats = [format], outDir = outDir, fnRoot = fnRoot)

To display the file:
___________________________________________________

#create the graph from the .dat file (graph() saves the graph as a .png
file to location filenameTrunc.png)
graphPath.graph(filenameTrunc, 'png', height, width)

#we need to add the .png extension back on
filenameTrunc = filenameTrunc + ".png"

#get the png image and draw it on the desktop
#getPNG function is my own, and is shown below this
png = functions.getPNG(filenameTrunc)

#find the graph window
graph = self.FindWindowById(GRAPH_ID)

#update the graph image
graph = wx.StaticBitmap(self, GRAPH_ID, png, (280, 20), (png.GetWidth(),
png.GetHeight()))
        print ("\nNew graph created... width: %s height %s" % (height,
width))

#______________________________________________

def getPNG(location):
        '''
        Returns a png image
        '''
        return wx.Image(location, wx.BITMAP_TYPE_PNG).ConvertToBitmap()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org