[PyQt] Re: how to show interactive Picture
mpi at comxnet.dk
Tue Feb 10 08:34:14 GMT 2009
--------- Original Besked --------
Fra: Markus Feldmann <feldmann_markus at gmx.de>
Til: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
Emne: [PyQt] Re: how to show interactive Picture
Dato: 09/02/09 23:58
> Mads Ipsen schrieb:
> > Could is be that you try to paint before the window is shown? You
> > call show() before you can start painting. The following snippet
> > an error similar to yours:
> This is not all of my Code. So there is a <show()> in my main source
> code. This Source Code only shows a sub-widget of a MDI Application.
> However this window is shown, but without the picture.
> How do the program know in which widget shall the Pixmap
> be shown ?
> PyQt mailing list PyQt at riverbankcomputing.com
Thats something you tell the program. You reimplement the method
'paintEvent' for a widget class like in the example I posted. Then for a
particular instance of the widget, the window is painted everytime a
paintEvent occurs and the widget get painted. A paintEvent event occurs eg.
when a window is hidden underneath another window and then shown.
To a draw a pixmap onto a widget do something like this in the paintEvent
def paintEvent(self, event):
painter = QtGui.QPainter(64,64)
pixmap = QtGui.QPixmap()
More information about the PyQt