Commit 5c3920a4 by BellCodeEditor

auto save

parent a3f4471a
Showing with 23 additions and 10 deletions
......@@ -2,6 +2,8 @@ import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -12,8 +14,6 @@ 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') # 下一曲按钮
my_font=pygame.font.Font("neuropol.ttf",14)
music_list = []
path = "C:\\Users\\Administrator\\Desktop\\text"
......@@ -28,7 +28,6 @@ click = 0
play_button = stop_img
angle=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
......@@ -61,7 +60,13 @@ while True:
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
music=pygame.mixer.Sound(path + "\\" + music_list[num])
music_lcugth=music.get_length()
music_length=int(music_legth)
play_button = stop_img
if click % 2 == 0:
click += 2
......@@ -74,6 +79,10 @@ while True:
num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
music=pygame.mixer.Sound(path + "\\" + music_list[num])
music_lcugth=music.get_length()
music_length=int(music_legth)
play_button = stop_img
if click % 2 == 0:
click += 2
......@@ -86,11 +95,9 @@ 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=play_time//1000
play_time=play_time//60
play_m=play_time%60
info=str(play_m)+":"+str(play_s)
music=pygame.mixer.Sound(path + "\\" + music_list[num])
music_lcugth=music.get_length()
music_length=int(music_legth)
if play_button==stop_img:
new_logo=pygame.tranform.rotate(logo_img,angle)
......@@ -98,12 +105,17 @@ while True:
pos=(rect[0],rect[1])
angle=1
# 绘制画面
music_m=music_length//60
music_s=music_longth%60
if music_s<10:
music_s="0"+str(music_s)
info1=str(music_m)+":"+str(music_s)
text1=my_font.render("/"+info1,True,(0,0,0))
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(new_logo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
text=my_font.render(info,True,(255,255,255))
screen:bilt(text,(0,0))
screen.bite(text1,())
# 刷新画面
pygame.display.update()
\ 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