Commit fb6616c9 by BellCodeEditor

auto save

parent aacba416
Showing with 59 additions and 0 deletions
import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备
pygame.init()
background=pygame.image.load('bg.png')#背景
right=pygame.image.load('right.png')#蛇头
body=pygame.image.load('body.png')#蛇身
apple=pygame.image.load('apple.png')#苹果
# 创建一个窗口
screen=pygame.display.set_mode((660,480))
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
#接受到退出后结束程序
exit()
screen.blit(background,(0,0))#背景
screen.blit(right,(180,120))#蛇头
screen.blit(body,(150,120))#蛇身
screen.blit(body,(120,120))#蛇身
screen.blit(body,(120,90))#蛇身
screen.blit(apple,(360,300))#水果
pygame.display.update()#刷新画面
print("0")
class Person():
def __init__(self,name,age,gender,birth):
self.name=name
self.age=age
self.gender=gender
self.birth=birth
def speak():
print("我叫",self.name)
print("我今年",self.age)
print("我出生于",self.birth)
tww=Person("Tww","1","男","2007-7-6")
tww.speak()
\ No newline at end of file
class :
def cat(self,name):
self.name = name
print(self.name+"去捉老鼠")
def sleep(self,time):
self.time=time
print("捉完老鼠要休息"+str(self.time)+"分钟")
Tom= Cat()
Tom.cat("汤姆")
Tom.sleep(20)
\ No newline at end of file
class Zfx():
def __init__(self,b):
self.b=b
def C(self):
print(4*b)
def S(self):
print(b*b)
zfx=Zfx(4)
zfx.S
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment