Home > other >  Questions about a python? Consult a great god
Questions about a python? Consult a great god

Time:09-22

Just start learning python step by step according to the book write code
But is always an error which a great god, please help take a look at why?
The import sys
The import pygame


The from Settings import Settings

Def run_game () :
Pygame. The init ()
Ai_settings=Settings ()
Screen=pygame. Display. Set_mode (
(ai_settings. Screen_width, ai_settings. Screen_height))
Pygame. Display. Set_caption (" Alien night ")



While True:
For the event in pygame. Event. The get () :
If the event. The type==pygame. QUIT:
Sys. The exit ()
Screen. The fill (bg_color)
Pygame. Display. Flip ()

Run_game ()


The class Settings () :

Def _init_ (self) :

Slef. Screen_width=1200
Slef. Screen_height=800
Self. Bg_color=(230230230)
  • Related