Commit 994f8eda by BellCodeEditor

auto save

parent bdb931da
Showing with 10 additions and 7 deletions
import pygame
from pygame import locals
import os
angle=90
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -11,10 +11,10 @@ play_img = pygame.image.load('play.png') # 播放按钮
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') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 旋转图片
music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test"
path = "C:\\Users\\Lenovo\\Desktop\\program\\music"
filelist = os.listdir(path)
num = -1
for i in filelist:
......@@ -57,7 +57,7 @@ while True:
num += 1
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + music_list[num])
pygame.mixer.music.load(path + '\\'+music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
......@@ -69,7 +69,7 @@ while True:
num -= 1
if num < 0:
num = len(filelist) - 1
pygame.mixer.music.load(path + music_list[num])
pygame.mixer.music.load(path + '\\'+ music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
......@@ -81,9 +81,12 @@ while True:
num += 1
if num > len(filelist)-1:
num = 0
pygame.mixer.music.load(path+music_list[num])
pygame.mixer.music.load(path+ '\\'+music_list[num])
pygame.mixer.music.play()
# 旋转图片
new_logo = pygame.transform.rotate(logo_img,angle)
angle-=1
new_logo.get_rect(center=(170,60))
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......
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