Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.

Follow publication

Member-only story

Make Your Own Music Player with Python

Rajat upadhyaya
Python in Plain English
3 min readMay 23, 2021

--

So here we are going to create our own music player with the help of Python. For this we will use three packages:

1. Tkinter → for UI

2. Pygame → for playing the music

3. os → for accessing your system’s files

So here we will see the each step for creating music player, we have divided our code into four parts.

In the first part we will import all the packages. Second we will create the UI. Third, we import all the music from the system and represent in application. Fourth, we define a function which will help in playing the particular music.

Before importing all these three packages we have to install these packages in our system.

pip install pygame

pip install tkinter

Os is already installed so we just need to import it:

from tkinter import *

from pygame import mixer

import os

So now we will see the next step.

So in this we are going to create UI for the application.

root = Tk()root.title(“music player”)Button(root,text= “play”, command = playsong).grid(row =1 , column =…

--

--

Published in Python in Plain English

New Python content every day. Follow to join our 3.5M+ monthly readers.

Written by Rajat upadhyaya

Application developer|Technical blogger|Youtuber(MASTERMIND CODER)|owner at www.yourtechnicalteacher.com

No responses yet

Write a response