[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Resizing QLabel
From: "F.A.Pinkse" <fapinkse () gmail ! com>
Date: 2011-08-19 15:41:35
Message-ID: j2m07l$h0k$1 () dough ! gmane ! org
[Download RAW message or body]
Hi All,
In Order to resize my images and keeping their aspect I did subclass
Qlabel Like this as found suggested elsewhere on the net:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MyLabel(QLabel):
def __init__(self, parent=None):
super(MyLabel, self).__init__(parent)
self.orgPixmap=None
def resizeEvent(self, event):
if self.orgPixmap != None:
pixmap = self.orgPixmap
size = event.size()
self.setPixmap(pixmap.scaledToHeight(size.height()-10))
print('resize', size.size())
It does what I want.. scaling my image when the label is resized all the
way up to screen size and down to the appliztion minimal window size.
Now when I do a Maximize on my application window and back the resizing
acts differently. I can see that the resizeEvent has been called
It does a few steps and stops when I release the mouse button I can do
this afain abd again only a few steps at the time.
What is happenign here?
I am Using windows XP, Python 3, PyQt4
Thanks
Frans.
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic