how to make a rectangle - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: News and Discussions (https://python-forum.io/forum-31.html) +--- Thread: how to make a rectangle (/thread-36740.html) |
how to make a rectangle - shanesgameYT - Mar-24-2022 im trying to make a rectangle on my screen and the rectangle shows up but for a split second after i click the close button this is my code in the main.py: import pygame from settings import * from tiles import * background_colour = (0, 0, 0) screen_width = 800 screen_height = 600 screen = pygame.display.set_mode((screen_width, screen_height)) test_tile = pygame.sprite.Group(Tile((100, 100), 200)) pygame.display.set_caption("my screen") screen.fill(background_colour) pygame.display.flip() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False pygame.display.update() clock.tick(60)and this is my code in the tilels.py: import pygame class Tile(pygame.sprite.Sprite): def __init__(self,pos,size): super().__init__() self.image = pygame.Surface((size,size)) self.image.fill('grey') self.rect = self.image.get_rect(topleft = pos)so i dont know how to make it show up while it is running please help.[attachment=1673][attachment=1674] |