[PyQt] QImage with a trapezoid draw result

Sergi Blanch i Torné sbt at ya.com
Wed Apr 16 09:57:05 BST 2008


I'm try to show an image on a widget but the image appears distorted. This 
widget is receiving images by events with a method where the dimensions has 
also to be sent:

	def eventReceived(self, EventSource, EventType, EventValue):
		self._imagedata = array.array('B',EventValue.value).tostring()
		self._imagedim = [EventValue.dim_x, EventValue.dim_y]

As this function says (or this is what I try), the image is composed by 
unsigned short values (it's grayscale). Then I have a method where the QImage 
object is created and resized:

	def ImageResize(self):
		self._image = QtGui.QImage(self._imagedata,
		width,height = [self.width(),self.height()]
		self._image = self._image.scaled(width,height,

The image show on the screen looks trapezoidal like if the width hadn't been 
well calculated. I try closing a plus minus value to fix this inclination but 
without success.

I explain the same but with image samples where:
And there you can found a link to the widget current code.

Sano kaj liber!


More information about the PyQt mailing list