Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson6_diy2

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 46e94d25 authored 3 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 46f034dd
Show whitespace changes
Inline Side-by-side
Showing with 4 additions and 11 deletions
  • my_music.py
my_music.py
View file @ 46e94d25
......@@ -3,13 +3,8 @@ from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
#设置标题
pygame.display.set_caption('音乐播放器')
# 载入图片、资源
bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮
......@@ -58,9 +53,7 @@ while True:
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.unpause()
new_logo = pygame.transform.rotate(logo_img, angle)
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 420 and x < 520 and y > 350 and y < 400: # 下一曲
......@@ -97,8 +90,9 @@ while True:
new_logo = pygame.transform.rotate(logo_img, angle)
new_rect = new_logo.get_rect(center=(320,200))
pop = (new_rect[0],new_rect[1])
angle += 1
# 绘制画面
if play_button == stop_img:
angle -= 1
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(new_logo, (pop)) # 中间logo图
......@@ -106,4 +100,4 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
#设置帧率
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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