1
我的代碼顯示記分牌總是閃爍,因爲我使背景變白。但我想要停下來。那麼是否有辦法讓pygame完成所有這些繪圖工作,並且在沒有顯示更新的情況下進行填充?當繪圖完成時,它會顯示新的結果,因此我不必看到每一步並因此閃爍?pygame閃爍屏幕修復
def score():
while ScoreTrue:
pygame.event.get()
window.fill(white)
display_score= (display_height/ 1.2)
message_display("Scoreboard", 2, 5)
message_meduim("5th place: " + ", ".join(repr(e) for e in Scoreboard[0]), 3, display_score)
message_meduim("4th place:" + ", ".join(repr(e) for e in Scoreboard[1]), 3, display_score - 100)
message_meduim("3rd place:" + ", ".join(repr(e) for e in Scoreboard[2]), 3, display_score - 200)
message_meduim("2nd place:" + ", ".join(repr(e) for e in Scoreboard[3]), 3, display_score - 300)
message_meduim("1st place:" + ", ".join(repr(e) for e in Scoreboard[4]), 3, display_score - 400)
Button("Play again", display_width/1.2,display_height/1.6, display_width/8, display_height/9, red, red_light, "play")