JAR equivalent in Gordon McMillan's Installer
Paul Moore
gustav at morpheus.demon.co.uk
Fri Feb 15 17:05:31 EST 2002
On 14 Feb 2002 23:34:12 +0100, Chris Liechti <cliechti at gmx.net> wrote:
>Paul Moore <gustav at morpheus.demon.co.uk> wrote in
>news:efao6us1tt3ut2hp6aor19p7qfqad3k4t1 at 4ax.com:
>...
>> Hmm. Looks more messy than I'd hoped. Needs a bootstrap module, and
>> then extra hacking to handle open/read. And I guess the fact that
>> I'm doing this manually means that there's not much chance of
>> something like a wxPython toolbar "just working" with icons stored
>> in the archive.
>
>well you could pack the stuff in a zipfile and retreive the data with
>the zipfile module. you get the data as string but you can wrap that
>again in a cStringIO object to get a file-like object.
I looked a bit closer at this. Interesting. Using the zipfile module
makes it trivial to get the raw data from an entry in a zipfile. And as
you say, I can use cStringIO to get a Python file object from this.
For text files, that's all I need really.
For sound files (on Windows) I can use the winsound module, with the
SND_MEMORY option to play from a memory image.
>but then wxWindows Bitmap.LoadFile wants real file...
>but: """wxBitmapFromXPMData(listOfStrings) Create a bitmap from a
>Python list of strings whose contents are XPM data""" so you would be
>limited to XPM images.
Looks like it's wxPython that has the problem...
Annoyingly, wxWindows has a wxImage constructor, wxImage(wxInputStream)
to load from a stream, but wxPython *doesn't* seem to wrap this
constructor. OK, so there would need to be a conversion from a Python
file object to a wxInputStream (or something).
But some way of getting a wxImage from in-memory data (of arbitrary
format) is really all I'm after - and there ought to be a way to get it.
I've copied this to the wxPython list. Is there some way I've missed -
or could a way be added?
Thanks,
Paul Moore
More information about the Python-list
mailing list