[Qgis-developer] How to get renderComplete painter reference

Anita Graser anitagraser at gmx.at
Mon Apr 7 12:21:20 PDT 2014


Am 07.04.2014, 11:57 Uhr, schrieb Martin Dobias <wonder.sk at gmail.com>:
> Yeah, anyway I checked again and even original Anita's statement
> worked for me. This is what I did in python console:
>
> from PyQt4.QtCore import *
> class A(QObject):
>   def __init__(self): QObject.__init__(self)
>   def f(self, painter): import sys; sys.__stdout__.write("hello\n")
> a = A()
> iface.mapCanvas().renderComplete.connect(a.f)
>
> when moving the map, it will output "hello" to the system console from
> where I started QGIS... so problem is probably somewhere else, not
> with connection itself.


 From what I could figure out so far, I only get the painter into  
playAnimation() if I do the following trick with lambda:

QTimer.singleShot(self.animationFrameLength, lambda:  
self.playAnimation(painter))

But even then, the exported images are without label ...

Best wishes,
Anita

-- 
anitagraser.com


More information about the Qgis-developer mailing list