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

Administrator / pygame_lesson5_diy2

  • 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 89fc054a authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent a9e36b61
Hide whitespace changes
Inline Side-by-side
Showing with 12 additions and 2 deletions
  • 1.py
  • my_music.py
1.py 0 → 100644
View file @ 89fc054a
import os
aa=os.listdir('C:\\Users\\Administrator\\Desktop\\test')
print(aa)
This diff is collapsed. Click to expand it.
my_music.py
View file @ 89fc054a
import pygame import pygame
import os
from pygame import locals from pygame import locals
pygame.init() # 初始化 pygame.init() # 初始化
...@@ -18,7 +19,13 @@ volume = 0.2 ...@@ -18,7 +19,13 @@ volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量 pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0 click = 0
play_button = stop_img play_button = stop_img
list_yy=['歌曲1.wav','歌曲2.wav','歌曲3.wav''歌曲4.ogg'] aa=os.listdir('C:\\Users\\Administrator\\Desktop\\test')
list_yy=[]
for i in aa:
if i[-4:] =='.wav' or i[-4:] =='.ogg':
aa.append(i)
num=-1 num=-1
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -55,7 +62,7 @@ while True: ...@@ -55,7 +62,7 @@ while True:
num+=1 num+=1
if num>len(list_yy)-1: if num>len(list_yy)-1:
num=0 num=0
pygame.mixer.music.load(list_yy[num]) pygame.mixer.music.load('C:\\Users\\Administrator\\Desktop\\test'+'\\'+ list_yy[num])
pygame.mixer.music.play() pygame.mixer.music.play()
......
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