Questions tagged as 'pygame'

1
answer

How to create a "trigger" function when a variable changes in value?

Looking at pygame.Surface.get_rect () , I realize that when I change a variable, for example left , pygame recalculates all class variables automatically ( center , right , etc). I'd like to know, how is this done? How c...
asked by 02.10.2018 / 20:57
2
answers

How to solve these libpng errors in pygame?

These errors are shown when I close the game: libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB These errors happen because I'm using this: pygame.display.set_icon(pygame.image.loa...
asked by 04.11.2017 / 13:36
1
answer

How to get a pixel color out of the screen border in pygame?

I know that to get a pixel color in PyGame I use get_at . But I have a huge background image and a good part of it stays outside of the pygame delimited screen area. For example, a 1000x1000 image inside a 500x500 screen will only have...
asked by 21.09.2018 / 01:39
1
answer

How to organize the pygame code correctly?

I came from JavaScript which is a bit simpler than Python, so I did not have to worry about scoping (almost everything was global) or code organization. But in Python even though it is a language that has a better syntax I can not organize the c...
asked by 01.11.2017 / 01:29
2
answers

Doubt about KeyPress in Pygame

I have a question regarding Pygame. I'm starting to fiddle and I found a problem here. When I press the A (left) button, I move the image to the left, until everything is ok. But if you keep the key pressed it does not repeat the movement. I...
asked by 03.11.2017 / 18:25
1
answer

How to make a program run inside a pygame window?

I made a window using pygame, and I have a code that wanted it to run inside of it, but I do not know how to do it, if anyone can help I'm very grateful. Here is the window code: pygame.init() tela = pygame.display.set_mode([500, 400]) pyga...
asked by 21.11.2018 / 17:39
1
answer

Complex operations with Python (pygame.math.Vector2)

I'm learning Python and came across a complex expression that derives from pygame.Vector2 : import pygame x = pygame.math.Vector2(1,2) b = x * 5 - (1, 2) print(x) print(b) Result: [1, 2] [4, 8] In the above case, the same x *...
asked by 29.09.2018 / 03:13
1
answer

Why is such a simple game getting so heavy?

This is the first project I've developed using Pygame. Because it was a simple card game I expected it to be very light but not really. As I am using a very weak computer (single core 1gb ram) it is easy to see it, here it is running below 20 fp...
asked by 01.05.2018 / 16:52
2
answers

Autocomplete does not always work on Pycharm

I'm starting to use Pycharm, creating a test with Pygame. I realize that some Pygame methods do not appear in Pycharm AutoComplete. For example, if I want to put a pygame.mask.from_surface() , typing pygame.mas will not do any...
asked by 14.06.2018 / 03:29
1
answer

Is there any problem in using pygame.image.load () several times?

I am creating a class called Button , and one of the properties of this class is an image. I wanted to know if there is a problem, if within this class I used self.imagem = pygame.image.load() to not have to pass the image as an...
asked by 01.12.2017 / 14:46