当前位置: 代码迷 >> QT开发 >> 怎样建一个透明的QImage
  详细解决方案

怎样建一个透明的QImage

热度:109   发布时间:2016-04-25 05:00:58.0
【求助】怎样建一个透明的QImage
我想建一个透明的QImage,在上面画图,怎样弄?
我是初学,请说的详细点。谢谢了

------解决方案--------------------
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys
try:
from PySide import QtGui, QtCore
except ImportError:
from PyQt4 import QtGui, QtCore

app = QtGui.QApplication(sys.argv)
img = QtGui.QImage(400, 300, QtGui.QImage.Format_ARGB32)
img.fill(0)
img.save("test.png")
#sys.exit(app.exec_())