#๐Ÿ”’ Need help with Pygame (Pycharm)

9 messages ยท Page 1 of 1 (latest)

modern nest
#

so I wanted to load the background image to the screen but instead i got a black screen and pycharm show no problem nor I was able to detect any problem through debugging

median zincBOT
#

@modern nest

Python help channel opened

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.

modern nest
#

import pygame
pygame.init()

Scr_width = 1000
Scr_height = 600

screen = pygame.display.set_mode((Scr_width,Scr_height))
pygame.display.set_caption("Brawler")
bg_image = pygame.image.load("background.jpg").convert_alpha()
def draw_bg():
scaled_bg = pygame.transform.scale(bg_image, (Scr_width,Scr_height))
screen.blit(scaled_bg, (0,0))
run = True

while run:
draw_bg()

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        run = False

pygame.quit()

#
import pygame
pygame.init()

Scr_width = 1000
Scr_height = 600


screen = pygame.display.set_mode((Scr_width,Scr_height))
pygame.display.set_caption("Brawler")
bg_image = pygame.image.load("background.jpg").convert_alpha()
def draw_bg():
    scaled_bg = pygame.transform.scale(bg_image, (Scr_width,Scr_height))
    screen.blit(scaled_bg, (0,0))
run = True

while run:
    draw_bg()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

pygame.quit()

#

and here the file

#

I might response later I had club in 2 mins

median zincBOT
#

@modern nest

Python help channel closed

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.