Commit 76b8759a by BellCodeEditor

auto save

parent 1fbacccc
Showing with 7 additions and 3 deletions
...@@ -4,6 +4,8 @@ click=0 ...@@ -4,6 +4,8 @@ click=0
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
pygame.mixer.music.load("test.wav")#载入音乐文件
# 载入图片、资源 # 载入图片、资源
bg_img = pygame.image.load('background.png') # 背景图 bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮 play_img = pygame.image.load('play.png') # 播放按钮
...@@ -15,9 +17,11 @@ pygame.mixer.music.load("歌曲1.wav") ...@@ -15,9 +17,11 @@ pygame.mixer.music.load("歌曲1.wav")
volume=0.1 volume=0.1
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
while True: while True:
if pygame.mixer.music.get_busy()==False:
pygame.mixer.music.play()#播放
for event in pygame.event.get(): for event in pygame.event.get():
??#点击关闭按钮,程序结束 if event.type==locals.QUIT:#点击关闭按钮,程序结束
exit()
# 绘制画面 # 绘制画面
...@@ -27,4 +31,4 @@ while True: ...@@ -27,4 +31,4 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
?? pygame.display.update()
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