views:

82

answers:

2

Hi,

I have some code:

l1 = clutter.Label()
l1.set_position(100,100)
for i in range(0,10):
 l1.set_text(str(i))
 time.sleep(1)

That is designed to show a count from 1 to 10 seconds on the screen in clutter, but I'm getting a strange error. When I run the script normally the screen runs as it should do, but there is no text displayed until 10 seconds are up. However, When I run with breakpoints in pdb the text shows up just fine.

I'm also getting a strange error at the start of the program:

do_wait: drmWaitVBlank returned -1, IRQs don't seem to be working correctly.
Try adjusting the vlank_mode configuration parameter.

But I don't see why that would affect the code out of break points but not in breakpoints.

Any help would be greatly appreciated.

A: 

Have you tried posting (or searching) on the Clutter mailing list? Here's someone who got the same message about drmWaitVBlank for example.

My guess is most people on SO wouldn't be familiar with solving Clutter problems. I know I'm not :)

lost-theory
+2  A: 

Not sure if you've already figured out the answer to this but:

The reason you are having this problem is because you are blocking the main thread (where all the drawing occurs) with your time.sleep() calls, preventing the library from redrawing the screen.

E.g. your code is currently doing this:

  1. Clutter redraws the screen.
  2. You loop over ten seconds and change the text ten times.
  3. Clutter redraws the screen.

If you want to queue something on a timer, you should look into gobject.timeout_add.

Steven Wei