用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - python代码库

音乐

2021-08-24 作者: 举报

[python]代码库

# 倾听音乐:享受生活。快乐每一天!
import pygame
import os
import sys
import time
import easygui as es
from pygame.locals import *
import tkinter.messagebox

print("加载中...")
pygame.time.wait(5000)
import Loding
pygame.time.wait(10000)

es.msgbox(msg = """
此程序仅支持在Windows平台的cmd窗口运行,如果在别的系统或别的程序下运行可能会运行失败或者效果变差!

This program only supports running in the CMD window of Windows platform.
If it is run under other systems or other programs,it may fail or the effect may become worse !"""
          ,title = """
提示(Tips)

                       """
          ,ok_button =
"""
我知道了
OK
""")

size = 1024,625 
imge_size = 1024,625

 
pygame.init()
print(pygame.get_sdl_version()) 
pygame.time.wait(2000)
pygame.time.delay(2000) 


times = pygame.time.get_ticks()/1000 
es.msgbox(msg="You have loaded a totla of:"+str(times)+"second"
,title="Loading time"
,ok_button="OK") 

 
pygame.mixer.init()

es.msgbox(msg = """
======================================================================
Music address:./素材/音乐/
Music List:
消愁-毛不易.mp3  爆爽游戏音乐.ogg  冬眠.mp3  踏山河.mp3  Dont'touch.mp3

======================================================================        
"""
,ok_button = "I have found a piece of music I like"
             ,title = "Music List")


musci_files = input("Please enter the full music path:")
pygame.mixer.music.load(musci_files) 
pygame.mixer.music.set_volume(0.6) 
pygame.mixer.music.play(-1,0) 
pygame.mouse.set_pos(249,212) 

scenn = pygame.display.set_mode(size)
pygame.display.set_caption("倾听音乐:享受生活!")
img = pygame.image.load("./素材/图片/imgs.jpeg")
pygame.display.update()
while True:
    for event in pygame.event.get():
        if event == quit:
            pygame.quit()
            exit()
        pygame.display.update()
        os.system("cls")
        print("Mouse current coordinates is :",pygame.mouse.get_pos())
        starts = pygame.key.get_focused() 
      
        if starts == 1:
            print("Your music is playing...")
            pygame.mixer.music.unpause()
        else:
          
            pygame.mixer.music.pause()
            print("The music has paused. You need to point the cursor at the music player and press it to continue playing...")
        print(pygame.mixer.music.get_busy()) 
        scenn.blit(img,(0,0))


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...