![3d929579692999615dbc1077b764ccda.png](https://img-blog.csdnimg.cn/img_convert/3d929579692999615dbc1077b764ccda.png)
本节将教大家如何做一个简单的mp3,希望大家能有所收获,写的不足之处望大家谅解。
废话少说,直接上代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
import os
from tkinter import *
root = Tk()
root.title('老婆专用播放器')
root.geometry('800x600')
pygame.init()
music_path = r'C:UserszlcaoMusic'
current_play = 'R3hab - Skydrop (Radio Edit).mp3'
music_name = StringVar()
def play():
music_name.set(current_play)
pygame.mixer.music.load(os.path.join(music_path, current_play))
pygame.mixer.music.play()
Label(root, textvariable=music_name, font=('宋体', 14), justify='center',
bg='#ADD8E6').place(relx=0, rely=0.1, relwidt