Commit cb9814ce by BellCodeEditor

save project

parent 8de84095
Showing with 17 additions and 13 deletions
...@@ -5,6 +5,11 @@ def kun(): ...@@ -5,6 +5,11 @@ def kun():
if unit=='q': if unit=='q':
break break
else: else:
total.append(unit) try:
new_input=int(unit)
except:
print("要输入整数")
else:
total.append(unit)
print(total) print(total)
kun() kun()
\ No newline at end of file
...@@ -6,14 +6,14 @@ pygame.init() ...@@ -6,14 +6,14 @@ pygame.init()
fpsclock=pygame.time.Clock();fpsclock.tick(100) fpsclock=pygame.time.Clock();fpsclock.tick(100)
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
bg_img = pygame.image.load('background.png') # 背景图 bg_img pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮 play_img = pygame.image.load('play.png') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮 stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮 last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
my_font = pygame.font.Font("neuropol.ttf",20) my_font = pygame.font.Font("neuropol.ttf",20)
music_list = [] music_lit = []
path = "C:\\Users\\Administrator\\Desktop\\test" path = "C:\\Users\\Administrator\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
...@@ -24,7 +24,7 @@ volume = 0.2 ...@@ -24,7 +24,7 @@ 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
angle = 0 angle 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -32,7 +32,7 @@ while True: ...@@ -32,7 +32,7 @@ while True:
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_w: if event.key == locals.K_w:
volume += 0.1 v += 0.1
if volume > 1: if volume > 1:
volume = 1 volume = 1
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
...@@ -42,8 +42,8 @@ while True: ...@@ -42,8 +42,8 @@ while True:
volume = 0 volume = 0
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSBEBUTTONDOWN:
if event.button == 1: if event.button == 1
x, y = event.pos x, y = event.pos
if x > 270 and x < 370 and y > 350 and y < 450: if x > 270 and x < 370 and y > 350 and y < 450:
click += 1 click += 1
...@@ -54,7 +54,7 @@ while True: ...@@ -54,7 +54,7 @@ while True:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: if x > 420 and x < 520 and y > 350 and y < 400:
num += 1 num 1
if num > len(music_list) - 1: if num > len(music_list) - 1:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
...@@ -65,7 +65,7 @@ while True: ...@@ -65,7 +65,7 @@ while True:
else: else:
click += 1 click += 1
if x > 120 and x < 220 and y > 350 and y < 400: if x > 120 and< 220 and y > 350 and y < 400:
num -= 1 num -= 1
if num < 0: if num < 0:
num = len(music_list) - 1 num = len(music_list) - 1
...@@ -81,14 +81,12 @@ while True: ...@@ -81,14 +81,12 @@ while True:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixe.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
new_rect=new_logo.get_rect(center=(320,200)) new_rect=new_logo.get_rect(center=(320,200))
pos=(new_rect[0],new_rect[1]) pos=(new_rect[0],new_rect[1])
if play_button==stop_img: if playe=pygame.mixer.music.get_pos()
angle += 1
play_time=pygame.mixer.music.get_pos()
mmm=(play_time//1000)//60 mmm=(play_time//1000)//60
sss=(play_time//1000)%60 sss=(play_time//1000)%60
new_render=str(mmm)+':'+str(sss) new_render=str(mmm)+':'+str(sss)
......
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