Coders Packet

Offline Music Player using Tkinter Python

By Kaushik karthikeyan K

This Project is to develop a Music Player which works offline using the Tkinter module in Python.


          This Project is to develop a Music Player which works offline using the Tkinter module in Python. By Choosing the Music Folder, It can play all songs for you.



1.Easy to use

2.No Extra Memory Needed

3.Simple and User Friendly



Python Any Versions

Tkinter Module:

Os Module:

Pygame Module:



import pygame
import tkinter as tkr
from tkinter.filedialog import askdirectory
import os

musicplayer = tkr.Tk() musicplayer.title("Offline Music Player") musicplayer.geometry("450x350") directory = askdirectory() os.chdir(directory) songlist = os.listdir() playlist = tkr.Listbox(musicplayer, font ="Helvetica 12 bold", bg="yellow",selectmode= tkr.SINGLE) for item in songlist: pos = 0 playlist.insert(pos, item) pos = pos + 1 pygame.init() pygame.mixer.init() def play(): var.set(playlist.get(tkr.ACTIVE)) def ExitMusicPlayer(): def pause(): def unpause(): Button1 = tkr.Button(musicplayer,width=5,height=3, font="Helvetica 12 bold",text="PLAY",command=play,bg="black",fg="gold") Button2 = tkr.Button(musicplayer,width=5,height=3, font="Helvetica 12 bold",text="STOP",command=ExitMusicPlayer,bg="black",fg="silver") Button3 = tkr.Button(musicplayer,width=5,height=3, font="Helvetica 12 bold",text="PAUSE",command=pause,bg="black",fg="blue") Button4 = tkr.Button(musicplayer,width=5,height=3, font="Helvetica 12 bold",text="CONTINUE",command=unpause,bg="black",fg="gold") var = tkr.StringVar() songtitle = tkr.Label(musicplayer, font="Helvetica 12 bold", textvariable=var) songtitle.pack() Button1.pack(fill="x") Button2.pack(fill="x") Button3.pack(fill="x") Button4.pack(fill="x") playlist.pack(fill="both",expand="yes") musicplayer.mainloop()






 From the Above project, we learned some modules in Tkinter and pygame and used them to create a Music player.

Download Complete Code


No comments yet