Skip to content
Advertisement

Why does pygame load slow?

I have a simple project that display a “button” with an image,a text and a background color:

JavaScript

that’s works fine but the problem is that when i launch the game it load the main window, wait some time(something like 1 second) and then load the button.I tried to add more button and it loaded them one at a time.I don’t undestand why.

Advertisement

Answer

Two Fixes

  1. Use a local image rather than an image sent with requests
  2. It loads slowly maybe because of the draw function of the MainWindow class.
    Try this in the main loop function
JavaScript

And at the end

JavaScript

So you don’t have to call main.draw() because it is already being called in the main loop.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement