歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> Linux資訊 >> 更多Linux

wxPython中的img2py的使用方法簡介

  在查看wXPython自帶的demo的源代碼的時候總是有一點特別奇怪,它那裡有一個文件是images.py,它裡有一句是對一個解釋是這樣的: This file was generated by C:\PROJECTS\wx\wxPython\demo\encode_bitmaps.py 打開這個encode_bitmaps.py文件一看,發現居然是對wxpython.tools裡一個叫img2py的例程的調用。 原來這個img2py是將圖像轉為以py文件存儲的程序哦。終於明白了。 於是退出python的環境,到命令行下運行img2py看看。 果然有一大堆的參數。 下面是幫助的東東哦。 [myPHP] 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 fUCntions, (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. -u Don't use compression. Leaves the data uncompressed. -i Also output a function to return the image as a wxIcon. [/myphp] 呵呵,明白了。


[1] 

allow you to put multiple images in one Python source file. -u Don't use compression. Leaves the data uncompressed. -i Also output a function to return the image as a wxIcon. [/myphp] 呵呵,明白了。



Copyright © Linux教程網 All Rights Reserved