StrikerX
13th November 2007, 10:57
Hi, i want to save a QPixmap object as File.png...
format=QtCore.QString("png") #to QString.
intitialPath=QtCore.QDir.currentPath()+"/snapshot"+str(self.counter)+"."+format
fileName=QtGui.QFileDialog.getSaveFileName(self, "Save As", intitialPath, "PNG Files (*.png);;All Files (*.*)" )
if not fileName.isEmpty():
self.originalPixamp.save(fileName, format.toAscii())
self.counter += 1
self.counter is just for formatting the snapshot name.
Error:
self.originalPixamp.save(fileName, QtCore.QString(format.toAscii()))
TypeError: argument 2 of QPixmap.save() has an invalid type
However, in C++ i used it the same way and it works ?!
I'm using PyQt4
Thanks in advance.
format=QtCore.QString("png") #to QString.
intitialPath=QtCore.QDir.currentPath()+"/snapshot"+str(self.counter)+"."+format
fileName=QtGui.QFileDialog.getSaveFileName(self, "Save As", intitialPath, "PNG Files (*.png);;All Files (*.*)" )
if not fileName.isEmpty():
self.originalPixamp.save(fileName, format.toAscii())
self.counter += 1
self.counter is just for formatting the snapshot name.
Error:
self.originalPixamp.save(fileName, QtCore.QString(format.toAscii()))
TypeError: argument 2 of QPixmap.save() has an invalid type
However, in C++ i used it the same way and it works ?!
I'm using PyQt4
Thanks in advance.