Hi,
I want to use pywxrc to create a .py containing images for use as icons in my app. Can anyone point me to an example since I haven't found the docs helpful for this.
Hi,
I want to use pywxrc to create a .py containing images for use as icons in my app. Can anyone point me to an example since I haven't found the docs helpful for this.
Hi,
I want to use pywxrc to create a .py containing images for use as icons
in my app. Can anyone point me to an example since I haven’t found the
docs helpful for this.
You’ll want to use the img2py command to do this.
img2py
img2py.py – Convert an image to PNG format and embed it in a Python
module with appropriate code so it can be loaded into
a program at runtime. The benefit is that since it is
Python source code it can be delivered as a .pyc or
'compiled' into the program using freeze, py2exe, etc.
Usage:
img2py.py [options] image_file python_file
Options:
-m <#rrggbb> If the original image has a mask or transparency defined
it will be used by default. You can use this option to
override the default or provide a new mask by specifying
a colour in the image to mark as transparent.
-n <name> Normally generic names (getBitmap, etc.) are used for the
image access functions. If you use this option you can
specify a name that should be used to customize the access
functions, (getNameBitmap, etc.)
-c Maintain a catalog of names that can be used to reference
images. Catalog can be accessed via catalog and
index attributes of the module.
If the -n <name> option is specified then <name>
is used for the catalog key and index value, otherwise
the filename without any path or extension is used
as the key.
-a This flag specifies that the python_file should be appended
to instead of overwritten. This in combination with -n will
allow you to put multiple images in one Python source file.
-i Also output a function to return the image as a wxIcon.
-f Generate code compatible with the old function interface.
(This option is ON by default in 2.8, use -f to turn off.)
On Wednesday, March 20, 2019 at 8:14:34 AM UTC-7, Mark wrote:
–
Robin
Mark wrote:
I want to use pywxrc to create a .py containing images for use as icons in my app. Can anyone point me to an example since I haven't found the docs helpful for this.
Are you actually using XRC files to create your layouts? If not, you might find img2py to be a simpler choice. It is included with wxPython.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Ah, thank you, that’s exactly what I needed!
On Wednesday, March 20, 2019 at 4:45:41 PM UTC, Robin Dunn wrote:
On Wednesday, March 20, 2019 at 8:14:34 AM UTC-7, Mark wrote:
Hi,
I want to use pywxrc to create a .py containing images for use as icons
in my app. Can anyone point me to an example since I haven’t found the
docs helpful for this.
You’ll want to use the img2py command to do this.
img2py
img2py.py – Convert an image to PNG format and embed it in a Python
module with appropriate code so it can be loaded into
a program at runtime. The benefit is that since it is
Python source code it can be delivered as a .pyc or
'compiled' into the program using freeze, py2exe, etc.
Usage:
img2py.py [options] image_file python_file
Options:
-m <#rrggbb> If the original image has a mask or transparency defined
it will be used by default. You can use this option to
override the default or provide a new mask by specifying
a colour in the image to mark as transparent.
-n <name> Normally generic names (getBitmap, etc.) are used for the
image access functions. If you use this option you can
specify a name that should be used to customize the access
functions, (getNameBitmap, etc.)
-c Maintain a catalog of names that can be used to reference
images. Catalog can be accessed via catalog and
index attributes of the module.
If the -n <name> option is specified then <name>
is used for the catalog key and index value, otherwise
the filename without any path or extension is used
as the key.
-a This flag specifies that the python_file should be appended
to instead of overwritten. This in combination with -n will
allow you to put multiple images in one Python source file.
-i Also output a function to return the image as a wxIcon.
-f Generate code compatible with the old function interface.
(This option is ON by default in 2.8, use -f to turn off.)
–
Robin