window in pygame freeze while waiting

后端 未结 1 724
渐次进展
渐次进展 2020-12-21 21:10

I\'m using pygame for my game and its online but the problem is that whenever the main loop of the game waits for the socket from the server its freezes. so unless you are d

相关标签:
1条回答
  • 2020-12-21 21:19

    You must call pygame.event.pump() (which is implicitly called by pygame.event.get(), pygame.event.clear(), pygame.event.poll(), pygame.event.wait() or pygame.event.peek()) regularly in the thread that initialized the video subsystem (Pygame is built on SDL, hence the link to SDL documentation).

    I would also suggest that you don't use pygame.event.pump() and instead handle all events properly with pygame.event.get() or pygame.event.poll(). More about this here.

    0 讨论(0)
提交回复
热议问题