0

我已经使用pygame在python中完成了一个程序......

#some code before this...

    def screen4(cS,cC):
    screen.blit(background, backgroundRect)
    drawText1('Oops....!',font4,screen,250,120)
    drawText1(cC,font1,screen,250,210)
    drawText2('i s   t h e   c a p i t a l    o f        ',font1,screen,5,275)
    drawText1(cS,font1,screen,425,275)
    drawText2('F  i  n  a  l     S  c  o  r  e  :    '+str(point),font4,screen,55,375)
    drawText1('P  r  e  s  s     a  n  y      k  e  y     t  o    Q  u  i  t  .  .  .',font2,screen,120,535)
    pygame.display.flip()
    waitForPlayerToPressKey()

它继续..我想显示最终分数,如文本闪烁或任何其他效果..这可能与我所做的代码吗?请帮助我...

4

1 回答 1

0

I assume waitForPlayerToPressKey() does not return until the player presses some key. If so, without changing much of your code, it is not possible.

If you want to have control over what happens on the screen while waiting for a press, you could have your waitForPlayerToPressKey() return true when a button has been pressed. You could then do something like:

while(True):
    drawText()
    flip()
    if(waitForPlayerToPressKey()): 
        return

You could then set a timer - and change some show blit flag every second.

于 2013-08-22T16:45:30.720 回答