Could some one tell me why nothing happens when running this program x_x?

So basically im trying to make this grid of stars for something, however when I run the program no image appears on the screen. Please could someone tell me if there are any visible errors, as I just cant see a reason for this not to work.

This is the main program:

import sys
import pygame
from sett import Sett
from star import Star

class Stars:
    """Overall class to manage star assests and behaviour."""

    def __init__(self):
        """Initialise sky and create game resources."""
        self.sett = Sett()

        self.screen = pygame.display.set_mode(
            (self.sett.screen_width, self.sett.screen_height))

        self.stars = pygame.sprite.Group()

    def run_s(self):
        """start the main loop for the stars."""
        while True:

    def _check_events(self):
        """Respond to keypresses and mouse events."""
        for event in pygame.event.get():
            if event.type == pygame.QUIT:

    def _create_sky(self):
        """Create sky of stars"""
        #Determine how many stars fit in a row.
        star = Star(self)
        star_width, star_height = star.rect.size
        available_space_x = self.sett.screen_width - (2 * star_width)
        number_stars_x = available_space_x // (2 * star_width)

        #Determine how many rows fit on  the screen.
        available_space_y = (self.sett.screen_height - (3 * star_height))
        number_rows = available_space_y // (2 * star_height)

        #Create the full sky of aliens.
        for row_number in range(number_rows):
            for star_number in range(number_queens_x):
                self._create_star(star_number, row_number)

    def _create_star(self, queen_number, row_number):
        """Create star and place it in row"""
        star = Star(self)
        star_width, star_height = star.rect.size
        star.x = star_width + 2 * star_width * star_number
        star.rect.x = star.x
        star.rect.y = star_height + 2 * star.rect.height * row_number

    def _update_screen(self):
        """Update images on the screen and flip to the new screen"""
        #Redraw the screen for each pass through the loop.


if __name__ == '__main__':
    si = Stars()

this is the module containing the star:

import pygame
from pygame.sprite import Sprite
from sett import Sett

class Star(Sprite):
    """A class to represent a single star"""

    def __init__(self, ai_game):
        """Initialise the queen and set its starting position"""
        self.screen = ai_game.screen
        self.sett = ai_game.sett

        #Load star image and set its rect attribute.
        self.image = pygame.image.load('star1.bmp')
        self.rect = self.image.get_rect()

        #Start each new star near the top left of the screen.
        self.rect.x = self.rect.width
        self.rect.y = self.rect.height

        #Store the stars exact horizontal position.
        self.x = float(self.rect.x)

Any help woukd be greatly appreciated… thanks everyone.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.