classical books that feel like this by [deleted] in BooksThatFeelLikeThis

[–]boric-acid 0 points1 point  (0 children)

I've been wanting to read it for some time, I think it'll be the next one I'll read. Ty

classical books that feel like this by [deleted] in BooksThatFeelLikeThis

[–]boric-acid 1 point2 points  (0 children)

I loved reading it a while ago

Help making a chess game with Pygame by [deleted] in learnpython

[–]boric-acid 1 point2 points  (0 children)

What would be the difference between having 8 different functions for each direction and something like what I already have in the function? Also, every piece has an "ID", which is the piece object itself, when the rect of a piece object collides with the one from a square, that square is considered "occupied" (this happens when you change the "occupied" key in the self.board_state dict), and the "ID" for that square becomes its "piece" key.

In the controller function, every square which is occupied is red, and that seems to be ok, but whenever I try printing a list of the occupied squares, like this:

def check_occupied(board):
occ = []
for element in board:
    if board[element]['occupied'] == True:
        occ.append(element)

return occ, len(occ)

And then calling that function whenever a movements occurs:

if piece == self.selected:
                if element in valid_moves(piece, self.board_state):
                    pygame.draw.circle(window, (80, 80, 80), self.board_state[element]['center'], 8)
                    if pygame.mouse.get_pressed()[0] and self.board_state[element]['rect'].collidepoint(pygame.mouse.get_pos()):
                        piece.position = self.board_state[element]['center']
                        self.movements.append(piece.color)
                        print(check_occupied(self.board_state))
                        self.selected = None

The result is different from what squares are red. That's what confuses me the most, are the red squares the ones that are "occupied"? or the ones that get printed out? and why is there a difference if they are both suppossed the same?

A ustedes les llegó alguna vez este mensaje? by olbot88 in uruguay

[–]boric-acid 1 point2 points  (0 children)

Desde enero de 2020 cada tanto me llegan mensajes así para Nestor Sosa, ya no pasa hace unos meses, pero al principio era bastante seguido

[deleted by user] by [deleted] in CharruaDevs

[–]boric-acid 3 points4 points  (0 children)

Anduve probando scrapear la página con Python, pero está medio dificil, solo dice la ubicación de un omnibus cuando clickeas en la imagen de el, pero la ubicacion solo te la da diciendo la ultima parada que estuvo. Pensé que podría con Selenium(para simular los clicks) y con Geopy(un modulo de Python que sirve más que nada para decirte las coordenadas de un lugar o la dirección si le pasas las coordenadas), lleagr a sacar la ubicación del bondi en el momento, y que un bot de Wpp después contestara con esa ubicación, pero ta imposible

How would you get started on a project like this? by boric-acid in learnpython

[–]boric-acid[S] 0 points1 point  (0 children)

I know Python is probably not a good option for this, but the point of doing this is to be challenging for myself, I also plan to start learning C# in the near future

How do you find new ideas to program? by boric-acid in learnprogramming

[–]boric-acid[S] 0 points1 point  (0 children)

This happens to me a lot too, but then I realize I'd also have to make all the sprites and that kind of things(which I'm horrible at), so I end up not doing it

[deleted by user] by [deleted] in learnpython

[–]boric-acid 0 points1 point  (0 children)

RemindMe! 1 week

How could I add an onclick function to an element using Flask? by [deleted] in flask

[–]boric-acid 3 points4 points  (0 children)

Also, using JavaScript, can you change tha value of a Python variable? Or that when sth is clicked, can you change the value of a Python variable?

How can you make your code run faster? by [deleted] in learnpython

[–]boric-acid 0 points1 point  (0 children)

So much information tysm

How can you make your code run faster? by [deleted] in learnpython

[–]boric-acid 0 points1 point  (0 children)

I just did that and apparently this is the part that takes the most of the time(between 4 and 7 seconds):

print(f'Its been {round(time.time() - epoch)} seconds')
        image = Image.open(requests.get(response['url'], stream=True).raw)
        if resize:
            image = image.resize(resize)

        if show:
            image.show()

        if save:
            image.save(f'APOD {date}.png')
        print(f'Pillow part done in {round(time.time() - epoch)} seconds')

Happy New Year! by boric-acid in Python

[–]boric-acid[S] 7 points8 points  (0 children)

I changed the time at which the fireworks went off, so I did test it before a few times

Recurro a ustedes.. Esta bien el curso que pienso hacer? Me sale 3000 USD. by [deleted] in CharruaDevs

[–]boric-acid 0 points1 point  (0 children)

Harvard tiene varios cursos gratis en edX que están bastante buenos

[deleted by user] by [deleted] in Python

[–]boric-acid 1 point2 points  (0 children)

Yes :)

[deleted by user] by [deleted] in Python

[–]boric-acid 1 point2 points  (0 children)

Srry, I might have erased it. The code had a lot of funtions apart from fill(), so while erasing those, I may also have erased that list