Commit e0627c9b by BellCodeEditor

save project

parent f35a5409
Showing with 17 additions and 3 deletions
......@@ -3,6 +3,7 @@ from pygame import locals
import os
pygame.init() # 初始化
fps=pygame.time.Clock()
# 创建窗口
screen = pygame.display.set_mode((640, 480))
# 载入图片、资源
......@@ -12,6 +13,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
basic_font = pygame.font.Font('neuropol.ttf',14)
music_list = []
path = "C:\\Users\\23636\\Desktop\\text"
......@@ -26,6 +28,7 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -84,8 +87,15 @@ while True:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
info=str(play_m)+":"+str(play_s)
new_logo= pygame.transform.rotate(logo_img,angle)
angle+=1
if play_button==stop_img:
angle+=1
newrect=new_logo.get_rect(center=(320,200))
pos=(newrect[0],newrect[1])
# 绘制画面
......@@ -94,5 +104,9 @@ while True:
screen.blit(new_logo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
scoresurf=basic_font.render(info,True,(255,255,255))
screen.blit(scoresurf,(120,440))
# 刷新画面
pygame.display.update()
\ No newline at end of file
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