Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson4_diy4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 1ac651cb authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 05298656
Hide whitespace changes
Inline Side-by-side
Showing with 10 additions and 4 deletions
  • 2.py
  • my_music.py
2.py 0 → 100644
View file @ 1ac651cb
This diff is collapsed. Click to expand it.
my_music.py
View file @ 1ac651cb
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -11,11 +11,17 @@ 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
d=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.wav"]
#d=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.wav"]
a=1
b=0
c=stop_img
e=-1
h=[]
f="C:\\Users\\EDZ\\Desktop\\test"
g=os.listdir(f)
for i in g:
if i[-4:]==".wav" or i[-4:]==".ogg":
h.append(i)
pygame.mixer.music.set_volume(a)
while True:
for event in pygame.event.get():
......@@ -25,9 +31,9 @@ while True:
exit()
if pygame.mixer.music.get_busy() == False:
e+=1
if e>len(d)-1:
if e>len(h)-1:
e=0
pygame.mixer.music.load(d[e])
pygame.mixer.music.load(f+"\\"+h[e])
pygame.mixer.music.play()
if event.type==locals.KEYDOWN:
if event.key==locals.K_DOWN:
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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