Posts by Matheus Silva Pinto • 445 points
20 posts
-
-1
votes1
answer356
viewsQ: How do I list all the properties of an object?
I wanted to take only the properties of an object, and pass the value of each of these properties as an argument to a function.
pythonasked Matheus Silva Pinto 445 -
0
votes1
answer167
viewsA: Find more than one standard re python?
I solved the problem like this: def replace(pattern): text = pattern.group().lower() renturn "{}_{}".format(text[0], text[1]) regex = re.compile(r"([a-z][A-Z])|([a-z][0-9])") for x in files:…
-
0
votes1
answer167
viewsQ: Find more than one standard re python?
I’m trying to rename files using regex in python, with only one standard works: def new_string(pattern): text = pattern.group().lower() renturn "{}_{}".format(text[0], text[1]) regex =…
-
1
votes0
answers72
viewsQ: How to update the position of the text when changing the position of the button?
I have a boot class that is a Sprite and has as attribute text that is also a Sprite. I was wondering how to change the position of the text when I change the position of the boot rectum? import…
-
2
votes2
answers1186
viewsQ: How do I resolve 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 mistakes happen because I’m using it:…
-
1
votes1
answer112
viewsQ: How to transform a text into an identifier name?
I would like to be able to receive a string as a parameter and use as an identifier name, create a variable or function with that name (it is not used as a dictionary key). It is possible to do…
-
1
votes1
answer112
viewsQ: Doubts regarding the PEP8
I read the PEP8 but did not understand very well when using 2 blank spaces. I must use 2 spaces to separate a section of imports from another section? What sections a Python file normally displays?…
-
1
votes1
answer502
viewsQ: How to organize pygame code correctly?
I came from Javascript which is a little simpler than Python, there I didn’t need to worry too much about scope (almost everything was global) and not about code organization. But in Python even if…
-
1
votes2
answers2397
viewsQ: How to transform str into int?
I tried to turn the score into int as I did in Javascript but it didn’t work: placar = "0 x 0" print(int(placar)) I expected it to show 0 but it resulted in a mistake, as I do to turn the score into…
-
0
votes1
answer55
viewsQ: Is a function defined within a recursive function bad?
Hello. I had in javascript a code more or less like this: function loop (i) { function callback () { // fazia alguma coisa if (i < 10) loop(++i); } setTimeout(callback, 1000); } Basically a…
javascriptasked Matheus Silva Pinto 445 -
4
votes1
answer735
viewsQ: Losing image quality while resizing in pygame
I have some pictures of cards in size 140x190 and am using the method pygame.trnasform.scale to resize to 105x143 which is a proportional value. But it is losing quality, while the images of the…
-
10
votes3
answers883
viewsQ: How to create operators in Python?
I was searching the internet about why Python doesn’t have the operator ++ and I saw someone saying that you can create this operator. How do you do this? How to create a Python operator?…
-
3
votes1
answer1722
viewsQ: Is it possible to create 3d games with pygame?
Is it possible? And if possible I need to know how to draw my own 3d images or is there a website that provides free 3d images?
-
0
votes1
answer37
viewsQ: What class should the text class inherit?
When using pygame it is very common for user classes to inherit from pygame classes, for example a class of characters usually vaqi extend the class pygame.sprite.Sprite. But a text class could…
-
0
votes1
answer93
viewsQ: I am unable to use get_rect with Convert/convert_alpha and subsurface
I was doing so: class Esqueleto (pygame.sprite.Sprite): def __init__ (self): self.imagem = pygame.image.load("imagem/esqueleto.png") self.rect = self.imagem.get_rect() self.imagem =…
-
0
votes0
answers270
viewsQ: pygame.time.Clock.tick() why not use 60?
Why do most people use 40 instead of 60? 60 fps is no longer considered ideal? Is there a recommendation to use 40? And if I just call the method tick parameter-less?
-
5
votes2
answers461
viewsQ: Do I need to import a module several times?
I have a class file and a file for the main program, in the two files I need Pygame. I import the classes into the main program this way from classes import *. I need to import Pygame into the…
-
0
votes1
answer46
viewsA: Automatic scroll after page loading(site in wordpress)
Let’s say you clicked on the link to the product section a, just do so: <a href="www.seusite.com.br/#produtoA">Produto a</a> that #productoa is just the id of the section of the page you…
-
1
votes1
answer348
viewsQ: Is there a single way to use images in pygame?
I read in the documentation that the method exists image.load to read images, but it returns an object of the type Surface which is not always the most appropriate, so I wanted to know if there is a…
-
0
votes1
answer1131
viewsQ: How to turn a python file into an executable?
If I create an application in python and want other people to be able to use it, will other people have to install python in order to run it or is there a way to make it executable? And to create an…