Commit d054be63 by BellCodeEditor

auto save

parent 4cce4778
Showing with 4 additions and 9 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -20,12 +20,7 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
num = -1
music_list=[]
path='C:\\Users\\qiaoh\\Desktop\\test'
bdlist=os.listdir(path)
for i in bdlist:
if i[-4:] == '.wav'or i[-4:] == '.ogg':
music_list.append(i)
music_list=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -46,7 +41,7 @@ while True:
# 按下鼠标
if event.type == locals.MOUSEBUTTONDOWN:
# 次数增加
if event.button == 1:
if event.button == 1:#button==1 按下左键 button == 3 按下右键
x,y=event.pos
if x>270 and x<370 and y>350 and y<450:
click += 1
......@@ -61,7 +56,7 @@ while True:
num = num+1
if num>len(music_list)-1:
num=0
pygame.mixer.music.load(path+'\\'+music_list[num])
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play()
# 绘制画面
......
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