Hello,
I am using PyQwt, and I have some issues for saving charts.
Here is my code :
def saveChart(self):
fileName
= QtGui.
QFileDialog.
getSaveFileName(self,
'Export File Name',
'JPGgraph',
'JPG Documents (*.jpg)') if not fileName.isEmpty():
if not fileName.toLower().endsWith('.jpg'):
fileName += '.jpg'
currentPlot = self.plots[self.graphComboBox.currentIndex()].plot
screen
= QtGui.
QPixmap.
grabWidget(currentPlot
) #screen.fill(QtCore.Qt.white)
#print currentPlot.size()
#print currentPlot.rect()
#print currentPlot.sizeHint()
#print currentPlot.minimumSizeHint()
currentPlot.print_(screen, filtre)
screen.save(fileName, "JPG", -1)
def saveChart(self):
fileName = QtGui.QFileDialog.getSaveFileName(self, 'Export File Name', 'JPGgraph', 'JPG Documents (*.jpg)')
if not fileName.isEmpty():
if not fileName.toLower().endsWith('.jpg'):
fileName += '.jpg'
currentPlot = self.plots[self.graphComboBox.currentIndex()].plot
filtre = QwtPlotPrintFilter()
screen = QtGui.QPixmap.grabWidget(currentPlot)
#screen.fill(QtCore.Qt.white)
#print currentPlot.size()
#print currentPlot.rect()
#print currentPlot.sizeHint()
#print currentPlot.minimumSizeHint()
currentPlot.print_(screen, filtre)
screen.save(fileName, "JPG", -1)
To copy to clipboard, switch view to plain text mode
I have several QwtPlot in a QStackWidget, which is in a QHorizontalLayout, which is in a QWidget which is the central widget of my QMainWindow.
When I try to save on of my chart, either the width is higher than the height or the height is higher than the width.
The result is :
Or :
Someone know what I should do to solve this issue ?
Thanks in advance,
Cédric
Bookmarks