Commit 3bdb04b4 by BellCodeEditor

save project

parent 1754f9f4
Showing with 68 additions and 1 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -11,6 +11,41 @@ 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') # 下一曲按钮
w=[]
p=r'C:\Users\86139\Desktop\tzx'
e=os.listdir(p)
for i in e:
if i[-4:]=='.ogg' or i[-4:]=='.wav':
music_list.append(i)
r=-1
t=0.2
pygame.mixer.set_t(t)
y=0
u=stop_img
while True:
for event in pygame.event.get():
if event.type==locals.KEYDOWN:
exit()
if event.key==locals.K_UP:
t+=0.1
if t>1:
t=1
pygame.mixer.music.set_t(t)
if event.type==locals.K_DOWN:
t-=0,1
if t<0:
t=1
pygame.mixer.music.set_t(t)
if event.type==locals.MOUSEBUTTONDOWN:
chick+=1
if chick%2==0:
pygame.mixer.music.unpause()
play_button=stop_img
else:
pygame.mixer.music.pause()
# 载入音乐
pygame.mixer.music.load('歌曲4.ogg') # 载入音乐
......@@ -59,3 +94,34 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
if x>120 and <220 and y>350 and y<400:
r=r-1
if r<0:
r=le(music_list)-1
pygame.mixer.music.load(p+'\\'+music_list(r))
pygame.mixer.music.play()
click=0
play_button=stop_img
if x>420 and <520 and y>350 and y<400:
r=r+1
if r>len(music_list)-1:
r=0
pygame.mixer.music.load(p+'\\'+music_list(r))
pygame.mixer.music.play()
click=0
play_button=stop_img
if pygame.mixer.music.get_busy()==False:
r+=1
if r>len(filelist):
nem=0
print(r)
pygame.mixer.music.load(p+'\\'+music_list(r))
pygame.mixer.music.play()
\ 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