Home > other >  Pygame using idle without error but the image is black screen
Pygame using idle without error but the image is black screen

Time:09-16

The import pygame
The import sys
The import traceback
The from pygame. Locals import *

Pygame. The init ()

Pygame. Mixer. The init ()

Bg_size=width, height=480700
Screen=pygame. Display. Set_mode (bg_size)
Pygame. Display. Set_caption (" aircraft wars - Cai Huze ")

Background=pygame. Image. The load (" image/background. JPG "). The convert ()


# to load the game music


Def the main () :
Pygame. Mixer. Music. Play (1)

Clock=pygame. Time. Clock ()

Running=true

While running:
For the event in pygame. Event. The get () :
If the event type==the QUIT:
Pygame. Quit ()
Sys. The exit ()

Sceen. Bilt (background, (0, 0))

Pygame. Display. Flip ()

The clock. Tick (60)


If __name__=='__mian__ :
Try:
The main ()
Except SystemError:
Pass
Except:
Traceback. Print_exc ()
Pygame. Quit ()
Input ()

CodePudding user response:

Pygame after running a small icon, you try double-clicking on the small icon
  • Related