Commit 46e94d25 by BellCodeEditor

save project

parent 46f034dd
Showing with 4 additions and 11 deletions
......@@ -3,13 +3,8 @@ from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
#设置标题
pygame.display.set_caption('音乐播放器')
# 载入图片、资源
bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮
......@@ -58,9 +53,7 @@ while True:
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.unpause()
new_logo = pygame.transform.rotate(logo_img, angle)
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
......@@ -97,8 +90,9 @@ while True:
new_logo = pygame.transform.rotate(logo_img, angle)
new_rect = new_logo.get_rect(center=(320,200))
pop = (new_rect[0],new_rect[1])
angle += 1
# 绘制画面
if play_button == stop_img:
angle -= 1
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(new_logo, (pop)) # 中间logo图
......@@ -106,4 +100,4 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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