Python Forum
what's not working? black window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what's not working? black window
#3
Your code layout is not readable. Put imports at the very top of the file. Group functions and classes near top of the file. Put the main body of code at the bottom of the file. Use 2 blank lines after each function and after each class. Those are all python programming conventions that are widely used.

In addition, classes should have a doc string describing what the class is, and methods should have a doc string that describes what they do. Comments should be few. If the code is difficult to understand, reorganize the code so it is easy to understand instead of using many comments. And don't fill you code with useless comments. When I see a comment I expect the comment to tell me information that I cannot get from reading the code. These comments don't provide any additional information.
# Carica l'immagine del mirino
mirino = pygame.image.load("C:\\ProgramData\\ProgramPy\\mirino.png")
# Crea uno sprite per il mirino
sprite_mirino = pygame.sprite.Sprite()
Nor these:
        self.speedx = ENEMY_SPEED # La velocità orizzontale del nemico
        self.speedy = ENEMY_SPEED # La velocità verticale del nemico
Reply


Messages In This Thread
what's not working? black window - by codeweak - Nov-16-2023, 04:16 AM
RE: what's not working? black window - by Windspar - Nov-16-2023, 05:56 AM
RE: what's not working? black window - by deanhystad - Nov-16-2023, 06:28 AM
RE: what's not working? black window - by Benixon - Dec-07-2023, 02:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Screen is all black and nothing is updating, but I can't figure out why. SheeppOSU 10 4,334 Oct-23-2020, 12:29 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020