Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson4_diy4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • pygame_lesson4_diy4
  • ppp.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    auto save · 7f0179d8
    BellCodeEditor committed 2 years ago
    7f0179d8
ppp.py 731 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import pygame
from pygame import locals
pygame.init()

a=pygame.display.set_mode((660,800))
b=pygame.image.load('狗.webp')
shetou=right
while True:
    for event in pygame.event.get():
        print(event)
        if event.type == locals.QUIT:
            exit()
        if event.type == locals.KEYDOWN:
            if event.key == locals.K_UP and shetou!=down:
                shetou=up
            if event.key == locals.K_DOWN and shetou!=up:
                shetou=down
            if event.key == locals.K_RIGHT and shetou!=left:
                shetou=right
            if event.key == locals.K_LEFT and shetou!=right:
                shetou=left    
    a.blit(b,(0,0))
    pygame.display.update()