[Tutor] pygame blinking text

Timo timomlists at gmail.com
Mon Dec 12 18:43:39 CET 2011


Op 12-12-11 15:01, Cranky Frankie schreef:
> My Python presentation is just about complete. As a nice ending I want
> to do a pygame program that displays the group's .jpg, with the words
> "Thank You!" blinking, say on for a second and off for a second.
> Unfortunatley, I can't get the works to blink, but I can get them to
> appear for a short time:
>
> from livewires import games, color
Looks like you're not using pygame, but livewires. Why not try their 
mailinglist, I bet their knowledge is better than this *Python 
beginners* list.

Cheers,
Timo

>
> games.init(screen_width = 640, screen_height = 480, fps = 50)
>
> bg_image = games.load_image("AEMUG640x480.JPG", transparent = False)
> games.screen.background = bg_image
>
>
> ty_message = games.Message(value = "Thank You!",
>                               size = 100,
>                               color = color.red,
>                               x = games.screen.width/2,
>                               y = games.screen.height/2,
>                               lifetime = 100,
>                               after_death = 0)
>
> games.screen.add(ty_message)
>
> games.screen.mainloop()
>
>
>
> I tried putting the ty_message block in a WHILE TRUE loop, and that
> didn't work. Then I tried the same with the
> games.screen.add(ty_message) line and that didn't work either. I think
> what might work is if I can find a way to delete the ty_message and
> readd it, over and over in a loop with a delay, bu:
>
> games.screen.delete(ty_message)
>
> doesn't work - delete is not a valid method.
>
> Is there any way to get blinking text with pygame? This is not a deal
> breaker, but I thought the blinking text would be neat.
>



More information about the Tutor mailing list