• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

python pygame和你太美播放

武飞扬头像
steams-star
帮助1

此代码需调用同一目录下的音频

音频提取点击这里 提取码:1111

  1.  
    import tkinter as tk
  2.  
    from tkinter import *
  3.  
    import pygame
  4.  
    win1=tk.Tk()
  5.  
    win1.title('MY main')
  6.  
    win1.geometry('670x470')
  7.  
    def ji():
  8.  
    pygame.mixer.init()
  9.  
    pygame.mixer.music.load('ji.mp3')
  10.  
    pygame.mixer.music.play(1)
  11.  
    while pygame.mixer.music.get_busy():
  12.  
    pass
  13.  
    def ni():
  14.  
    pygame.mixer.init()
  15.  
    pygame.mixer.music.load('ni.mp3')
  16.  
    pygame.mixer.music.play(1)
  17.  
    while pygame.mixer.music.get_busy():
  18.  
    pass
  19.  
    def tai():
  20.  
    pygame.mixer.init()
  21.  
    pygame.mixer.music.load('tai.mp3')
  22.  
    pygame.mixer.music.play(1)
  23.  
    while pygame.mixer.music.get_busy():
  24.  
    pass
  25.  
    def mei():
  26.  
    pygame.mixer.init()
  27.  
    pygame.mixer.music.load('mei.mp3')
  28.  
    pygame.mixer.music.play(1)
  29.  
    while pygame.mixer.music.get_busy():
  30.  
    pass
  31.  
    def gan():
  32.  
    pygame.mixer.init()
  33.  
    pygame.mixer.music.load('gan.mp3')
  34.  
    pygame.mixer.music.play(1)
  35.  
    while pygame.mixer.music.get_busy():
  36.  
    pass
  37.  
    def aaaa():
  38.  
    pygame.mixer.init()
  39.  
    pygame.mixer.music.load('aaa.mp3')
  40.  
    pygame.mixer.music.play(1)
  41.  
    while pygame.mixer.music.get_busy():
  42.  
    pass
  43.  
    def aiyou():
  44.  
    pygame.mixer.init()
  45.  
    pygame.mixer.music.load('aiyou.mp3')
  46.  
    pygame.mixer.music.play(1)
  47.  
    while pygame.mixer.music.get_busy():
  48.  
    pass
  49.  
    Button(win1, text=" 鸡 ",command=ji).pack()
  50.  
    Button(win1, text=" 你 ",command=ni).pack()
  51.  
    Button(win1, text=" 太 ",command=tai).pack()
  52.  
    Button(win1, text=" 美 ",command=mei).pack()
  53.  
    Button(win1, text=" 干 ",command=gan).pack()
  54.  
    Button(win1, text=" 嘛 ",command=aaaa).pack()
  55.  
    Button(win1, text=" 哎呦 ",command=aiyou).pack()
  56.  
    win1.mainloop()
学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhggecie
系列文章
更多 icon
同类精品
更多 icon
继续加载