Home > other >  Python has a problem
Python has a problem

Time:09-22

Python error:
Traceback (the most recent call last) :
The File "C: \ Users \ LENOVO \ Desktop \ pg py", line 5, in & lt; module>
The from Settings import Settings
ModuleNotFoundError: No module named 'Settings'



Settings files and source files, why an error that no Settings file?
The following is a code
Pg. Py:
The import sys

The import pygame

The from Settings import Settings

Def run_game () :
Initial # im into the game and create a screen object
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 ")
Bg_color=(230230230)
# start playing the main loop of
While True:
For the event in pygame. Event. The get () :
If the event. The type==pygame. QUIT:
Sys. The exit ()
Screen. The fill (ai_settings. Bg_color)
Pygame. Display. Flip ()

Run_game ()

The following is the code for the Settings
Settings. Py:
The class Settings () :
Def _init_ (self) :
Self. Screen_width=1200
Self. Screen_hight=800
Self. Bg_color=(230230230)
Bother to teach, thank you
  • Related