pygame black screen #58287
Replies: 3 comments
-
|
I could not really find an error in your code you could try, however - To check for error messages: Run the code in a terminal or IDE that displays error messages. Look for any error messages or exceptions that might provide insights into the cause of the black screen. Verify Pygame installation: Ensure that you have the correct version of Pygame installed and that it is compatible with your Python environment. |
Beta Was this translation helpful? Give feedback.
-
|
You need to wrap the code inside a while loop that will continue until the game is exited, not just while True. This should get things to display, let me know if it works just had a similar thing happen to me. running = True |
Beta Was this translation helpful? Give feedback.
-
|
most likely reason for the black screen is that the display is not being updated correctly within the game loop try this code import pygame WIDTH = 800 pygame.init() class Cannon(pygame.sprite.Sprite): class Ball(pygame.sprite.Sprite): cannon = Cannon() while True: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
I'm trying to implement Newton's cannon thought experiment in pygame.
Pygame is already installed. But when I run this code, I get a black screen in pygame.. Help me!
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions