#🔒 pygame does not display anything
35 messages · Page 1 of 1 (latest)
@azure axle
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
code: ```import pygame
from pygame.time import Clock
WIDTH, HEIGHT = 1080, 1920
screen = pygame.display.set_mode((WIDTH, HEIGHT))
Create a circle surface
outer_ring_surface = pygame.Surface((30, 30), pygame.SRCALPHA)
pygame.draw.circle(outer_ring_surface, (255, 0, 0), (15, 15), 15)
clock = Clock()
running = True
while running:
for event in pygame.event.get(): # Use pygame.event.get() instead of pygame.event.QUIT
if event.type == pygame.QUIT:
running = False
# Fill the screen with black before drawing the circle
screen.fill((0, 0, 0))
# Blit the circle surface onto the screen
screen.blit(outer_ring_surface, (500, 200))
pygame.display.flip()
clock.tick(30)```
Output appears onclick of run
Did you initialize pygame?
I think pygame has an actual function called .init()
Requirement already satisfied: pygame in c:\python311\lib\site-packages (2.6.0)
[notice] A new release of pip is available: 24.0 -> 24.1.2
[notice] To update, run: python.exe -m pip install --upgrade pip```
Disregard flip() should’ve worked. Don’t think you need to call pygame.init().
I’m viewing your code on a phone so just, bare with me.
all good
take your time
thx for your help
Try putting a print statement within the while-loop to make sure it’s actually reaching it.
Let me get on my PC quickly, and I’ll try running it
Try this in the meantime, and lmk.
the loop is working
One second.
I don’t have Python 3.11 on hand right now, so it may not function on my end and vice versa since I’m using 3.12 but let me try tinkering first,
you do you
Think I might've found it, one second.
found it?
Not yet, gonna look into it more.
alright
I dont know whats going on, Ill check on it if no one else assists; but I really cannot see the issue.
you're good
Your circle is being drawn out of the screen, you screen size is 1080 X 1920 and the circle is at 500, 200, ie: not far enough down that super tall window to see in your screen
Put the circle at 500, 900 and you will see it
And you probably want to change the size of the window, it's too tall
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.