Why is the background not displaying?

Louis -  
 houilleux -

Hello,

I'm learning to use pygame and python in my free time, and I'm starting a project, but I don't understand why my background doesn't show up, and I have this error:

import pygame pygame.font.init() SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT)) background = pygame.image.load("objet/bg.jpg").convert() background = pygame.transform.scale(background, (SCREEN_WIDTH, SCREEN_HEIGHT)) screen.blit(background, (0, 0)) 

And then I wrote this in my main loop:

 screen.blit(background) pygame.display.update(((0, 0, SCREEN_WIDTH, SCREEN_HEIGHT))) 

And the error that is displayed:

TypeError: function missing required argument 'dest' (pos 2)

How can I solve this problem? Thank you

2 answers

  1. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   Ambassadeur 1 588
     

    Hello,

    it's strange to call blit() once with two arguments, then with just one.

    Do you understand the error message?

    0
  2. houilleux
     

    Hello.


    We have to move on to pygame.display.update, either with no parameter, or a pygame.Rect object, or a list of pygame.Rect.

    .

    There is no point in passing a Rect the size of the window, since that will be done by default.

    0