[PyQt] Text "write on" effect

JPolk jpolk5001 at yahoo.com
Tue Feb 28 01:02:01 GMT 2012


okay, this may seem a bit superfluous, but would be a very nice animation
effect to have in one's toolbox..

For those that don't know what a "write on" animation is,...you probably see
them on TV everyday,..
but it's when a whole sentence is displayed a character at time, with just a
fraction of a second delay
in-between each character...

Thought this would be trivial at first,...but there's something going on in
Qt that senses there's about to
be a bunch of fast updates, so it waits until everything is done and updates
*once*, which defeats the
purpose....

Here's how the madness unfolds,..

text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet"

accum = QString("")

 for i in range(0, len(text)):
         accum = accum + text[i]
         self.label.setText(accum)
         self.label.update()
         sleep(.1)

So, I accumulate the string char by char calling update() and sleep() at
each interval,...a button triggers this function.
But instead of seeing the effect progress as expected, it just display the
whole string at once...
Anybody got any ideas how to achieve this effect ?

I've attached a short example script...

Cheers,
Jim

http://python.6.n6.nabble.com/file/n4518350/writeon_v01.py writeon_v01.py 

--
View this message in context: http://python.6.n6.nabble.com/Text-write-on-effect-tp4518350p4518350.html
Sent from the PyQt mailing list archive at Nabble.com.


More information about the PyQt mailing list