Python Forum
[PyGame] drawing images onto pygame window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] drawing images onto pygame window
#2
self.stars is a SpriteGroup that you draw each frame. It looks like the only place you add items to that sprite group is in StarrySky.create_grid()... but I don't see anywhere where that function gets called. Should that be included in the __init__ method?

Something like:
    def __init__(self):
        """Initialise the game and create game resources."""
        pygame.init() # initialise the background settings 
        # which the game needs to work properly
        self.settings = Settings()
 
        self.screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
        # tells pygame to figure out a window size to fill the screen
        self.settings.screen_width = self.screen.get_rect().width
        self.settings.screen_height = self.screen.get_rect().height
        # updates the screen settings after fullscreen has been created
        pygame.display.set_caption("Starry Sky")
 
        self.star = Star(self)
        self.stars = pygame.sprite.Group()
        self.create_grid()
Reply


Messages In This Thread
drawing images onto pygame window - by djwilson0495 - Feb-22-2021, 10:12 AM
RE: drawing images onto pygame window - by nilamo - Feb-22-2021, 05:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Cannot display anything inside pygame window the_gullwing 5 1,147 Dec-07-2023, 02:44 AM
Last Post: Benixon
  pygame get window position vskarica 3 5,930 Oct-18-2020, 05:14 PM
Last Post: nilamo
  Unable to exit Pygame window Hesper 2 3,888 Mar-30-2020, 08:59 AM
Last Post: Hesper
  Pygame - Images As Buttons vman44 3 13,010 Mar-20-2020, 08:13 PM
Last Post: vman44
  drawing, moving, and collision problems (pygame) SheeppOSU 26 14,734 Apr-22-2019, 03:09 AM
Last Post: SheeppOSU
  Pygame loads only part of images Prof_Jar_Jar 3 3,088 Dec-22-2018, 03:42 PM
Last Post: Windspar
  [pyGame] More Text in one Window, example needed ! JamieVanCadsand 1 3,545 Oct-03-2017, 03:42 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020