[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))