Commit 4769ee3d by BellCodeEditor

save project

parent e85b6004
Showing with 26 additions and 7 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os import os
...@@ -44,16 +44,35 @@ while True: ...@@ -44,16 +44,35 @@ while True:
                pygame.mixer.music.set_volume(volume)                 pygame.mixer.music.set_volume(volume)
        # 按下鼠标         # 按下鼠标
        if x>120 and x<220 and y>350 and y<400:#上一曲按键的占位置         if event.type == locals.MOUSEBUTTONDOWN:
num -= 1             if event.button == 1:
if num<0:                 x,y = event.pos #position
num = len(music_list)-1                 if x>270 and x<370 and y>350 and y<450:
                    # 次数增加
                    click += 1
if x>420 and x<520 and y>350 and y<400:#下一曲按键位置
#功能由大家课下自行完成
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() pygame.mixer.music.play()
play_button = stop_img play_button = stop_img
click = 0 click = 0
杨沫
if x>420 and x<520 and y>350 and y<400:#下一曲按键位置                     if click % 2 == 0:
                        play_button = stop_img
                        pygame.mixer.music.unpause()
                    else:
                        play_button = play_img
                        pygame.mixer.music.pause()
    if pygame.mixer.music.get_busy() == False:
        num += 1
        if num > len(music_list)-1:
            num = 0
        pygame.mixer.music.load(music_list[num])
        pygame.mixer.music.play()
    # 绘制画面     # 绘制画面
    screen.blit(bg_img, (0, 0))      # 填充背景     screen.blit(bg_img, (0, 0))      # 填充背景
......
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