Reputation: 5
1 '''
2 Created on Nov 19, 2013
3
4 @author: martins
5 '''
6 bif = "background.jpg"
7 mif = "ball.png"
8
9 import pygame, sys
10 from pygame.locals import *
11
12 pygame.init()
13 screen = pygame.display.set_mode((800,800),0,32) #izveido logu
14
15 background = pygame.image.load(bif).convert()#pārveido bildes
16 mouse_c = pygame.image.load(mif).convert_alpha()#pārveido bildes
17
18 while True:
19 for event in pygame.event.get():
20 if event.type == QUIT:#nodrošina, ka programma pilnīgi aizveras
21 pygame.quit()
22 sys.exit()
23
24 screen.blit(background,(0,0)) #nokopē backgroundu uz ekrāna(logā)
25
26 x,y = pygame.mouse.get_pos()# noskaidro peles koardinātas
27 x-=mouse_c.get_width()/2 #ieliek kursoru bildei vid
28 y-=mouse_c.get_height()/2
29
30 screen.blit(mouse_c,(x,y))#nokpē
31
32 pygame.display.update()
I do not know why this is showing, but it is quite annoying because the code is running fine and doing what is supposed to do, i believe there are some trouble with interpreter, but i cannot figure out what it is. Thanks for help!
on line 10: Unused in wild import: Color, Rect, color
on line 12: Undefined variable from import: init
on line 20: Undefined variable: QUIT
on line 21: Undefined variable from import: quit
P.s. don't mind the coments they are for myself ;)
Upvotes: 0
Views: 145
Reputation: 122052
Those are warnings, not errors. For example, the first is telling you that although you have used a wild import
(e.g. import *
) from pygame.locals
, you aren't using some of the methods and attributes that would provide. According to the Python style guide (PEP8) you shouldn't use wildcard imports, or import multiple libraries on one line (i.e. import pygame, sys
).
Upvotes: 1