擅长:python、mysql、java
<p>要进行这种设置有点困难,但是从我读到的Python图像库(PIL)支持<a href="http://www.pythonware.com/library/pil/handbook/index.htm" rel="nofollow">bitmap and ICO files</a>和拥有{a2}。假设您可以获得图标的文件名,那么可以用PIL加载它,然后传输<a href="http://qt-project.org/forums/viewthread/5866/#35038" rel="nofollow">raw data to a QImage</a>:</p>
<pre><code>from PIL import Image
from PySide.QtGui import QImage, QImageReader, QLabel, QPixmap, QApplication
im = Image.open("my_image.png")
data = im.tostring('raw', 'RGBA')
app = QApplication([])
image = QImage(data, im.size[0], im.size[1], QImage.Format_ARGB32)
pix = QPixmap.fromImage(image)
lbl = QLabel()
lbl.setPixmap(pix)
lbl.show()
app.exec_()
</code></pre>
<p>然后从那里开始执行您需要执行的<code>QImage</code>操作。在</p>