[PyKDE] Embedding icon inside code
Roland Schulz
mail at r2s2.de
Mon Nov 10 09:04:00 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
On Monday 10 November 2003 05:53, Derek Fountain wrote:
> I have some code which requires an icon. The icon is currently in a PNG
> file. I want to have this code as reusable as possible, ideally in a
> position where I can redistribute just one file. So I'd like a way of
> embedding the icon pixmap inside the class.
>
> Is that possible, and if so, how do I do it?
You can convert the PNG file to a XPM file (in Unix you can use convert for
this). You just need to pythonize the syntax:
change e.g.
static char *match[] = {
/* columns rows colors chars-per-pixel */
to:
mathch[] = [
# ...
and than you can insert this xpm file into your python file. Creating a
QPixmap with this image works with QPixmap(match).
regards
Roland
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/r0Y5V/hlvQgMogsRAkp7AKC0DtQtjdsezyvNGZKjn1t7/36JYQCdHPVi
RNoaYjU771jqOIkSQb9Y9p0=
=Hfmd
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list