help me with this code pls | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

help me with this code pls

i creating a pygame code but it dont function this is the code import pygame import random pygame.init() background = pygame.image.load('images\sfondo.png') bird = pygame.image.load('images\uccello.png') base = pygame.image.load('images\base.png') gameover = pygame.image.load('images\gameover.png') tube1 = pygame.image.load('images\tubo.png') tube2 = pygame.transform.flip(tubo_giu, False, True) display = pygame.display.set_mode((288,512)) this i the error message (unicode error)'unicodeescape' codec cant decode bytes in position 6-10:truncated\uXXXX escape

6th Jan 2021, 2:26 PM
Simone
Simone - avatar
11 Réponses
+ 3
I don't know about pygame. However when copying file paths on windows os, we usually need to change backslashes to forward slashes, because (single) backslashes are reserved for escape sequences. I think that is what the error you got from your initial code wants to tell us.
6th Jan 2021, 3:15 PM
Lisa
Lisa - avatar
+ 4
Simone then you don't have to write 'images/background.png' but this: 'background.png'
6th Jan 2021, 2:44 PM
Baspberry
+ 2
Sololearn is not able to run this code because you need the pygame module. You can install it on your pc, but you have to install Visual Studio/ IDE / ... first. You can also use your phone by installing Pydroid.
6th Jan 2021, 2:31 PM
Baspberry
+ 2
Simone then you have to install the pygame module. If you don't know how, check some tutorials on youtube or google
6th Jan 2021, 2:35 PM
Baspberry
+ 2
Simone I think I can't help anymore but I will try
6th Jan 2021, 2:40 PM
Baspberry
+ 1
If someone answer to me i will be happy
6th Jan 2021, 2:43 PM
Simone
Simone - avatar
0
I installed the pygame libraries
6th Jan 2021, 2:35 PM
Simone
Simone - avatar
0
No but i search on google and if i write in code background=pygame.image.load('images/background.png') it function but it dont function with me
6th Jan 2021, 2:41 PM
Simone
Simone - avatar
0
Thanks for your help. I think i put the .py file in the images' folder
6th Jan 2021, 2:42 PM
Simone
Simone - avatar
0
Oh thanks lisa for answered. Thanks for the answerd. Now i modify the code and i write you if it function
6th Jan 2021, 3:23 PM
Simone
Simone - avatar
- 1
This code dont function in my pc
6th Jan 2021, 2:34 PM
Simone
Simone - avatar