[PyQt] how to show interactive Picture

2009-02-09 Thread Markus Feldmann
Hi All, i am programming a MDI Application where a Window in the workspace shall work as a Map Program. Therefore i want to show a Picture which is parted in many small hexagons. This hexagons can be selected with the mouse. Ok, i started first to set up the picture, but got trouble. Here are

[PyQt] Re: how to show interactive Picture

2009-02-09 Thread Markus Feldmann
Mads Ipsen schrieb: Could is be that you try to paint before the window is shown? You need to call show() before you can start painting. The following snippet generates an error similar to yours: Hi, This is not all of my Code. So there is a show() in my main source code. This Source Code

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
Mads Ipsen schrieb: - Original Besked Fra: Markus Feldmann feldmann_mar...@gmx.de Til: pyqt@riverbankcomputing.com pyqt@riverbankcomputing.com Emne: [PyQt] Re: how to show interactive Picture Dato: 09/02/09 23:58 Mads Ipsen schrieb: gt; Could is be that you try to paint before

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
I got the follwing Messages: QPainter::begin: Widget painting can only begin as a result of a paintEvent QPainter::save: Painter not active QPainter::restore: Unbalanced save/restore QPainter::end: Painter not active, aborted I can't find the soultion. Please help.

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
David Boddie schrieb: On Tue Feb 10 15:02:13 GMT 2009, Markus Feldmann wrote: I think my Problem is that i have to send an envent? Yes, you need to make a paint event happen. You can do this by calling the update() method on the widget you want to be updated. As you wrote i changed some

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
I changed the class Qwidget -- QSrollArea and got the same Problem as i have. So i think that i can not paint in a scrollarea ??? ### import sys from PyQt4 import QtCore, QtGui import basicdrawing_rc class

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
I go it. :-) I am not sure, but maybe i have to set a Widget in the ScrollArea, and in this Widget i may paint? Here is my Code: ## mport sys from PyQt4.QtGui import QMainWindow, QDockWidget, QPainter, QAction, QScrollArea

[PyQt] Zoom or scale into an QImage

2009-02-10 Thread Markus Feldmann
Hi All, i have an QScrollArea where i inserted a QLabel. This QLabel includes an QImage. I want to zoom/scale into this image. How can i do this? Regards Markus Here is a PART of my Code: ### class ScrollArea(QScrollArea): def

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
David Boddie schrieb: Here, because you are using a QLabel to show the image, it should automatically appear correctly in the QScrollArea. (Aside: If you create your own custom widget (by subclassing QWidget), you have to reimplement the sizeHint() method as well as the paintEvent() method to

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
David Boddie schrieb: import basicdrawing_rc Note that you need to have this module to be able to show the image used by the example. It is created by running pyrcc4 in the basicdrawing directory like this: pyrcc4 -o basicdrawing_rc.py basicdrawing.qrc This causes all the resources

[PyQt] Re: how to show interactive Picture

2009-02-10 Thread Markus Feldmann
David Boddie schrieb: It's not necessary to understand how to use resources initially, but you will find them useful when you start wanting to run the program from within different directories. This is a really important thing, but maybe i can bypass this with some python commands. :-) As i

[PyQt] Re: Zoom or scale into an QImage

2009-02-10 Thread Markus Feldmann
David Boddie schrieb: On Tue, 10 Feb 2009 22:45:51 +0100, Markus Feldmann wrote: i have an QScrollArea where i inserted a QLabel. This QLabel includes an QImage. I want to zoom/scale into this image. How can i do this? Try one of these approaches: 1. Keep the original image and show

[PyQt] Re: Zoom or scale into an QImage

2009-02-11 Thread Markus Feldmann
At this moment i am trying the example: http://doc.trolltech.com/4.4/widgets-imageviewer.html But i have trouble to convert the class-method scaleImage(). There is a Qt Method which is not listed in the Qt API Library. It is named Q_ASSERT. How should my PyQt4 Code looks like for this

[PyQt] Re: Zoom or scale into an QImage

2009-02-12 Thread Markus Feldmann
I got an error Message: unhandled AttributeError imgLabel I think he can not find this Attribute, but i am not sure. I have defined imgLabel in the __init__(self, parent=None) Class-Method. Do i have to make self.imgLabel a Class-Attribute to call it from another Class-Method ? What should be