Music Player Using Python: Submitted By: Mayank Kumar (1808210088)
Music Player Using Python: Submitted By: Mayank Kumar (1808210088)
Submitted by:
• What is Python?
• History of Python
• Approach
• MusicPlayer Class
Program Scripting
Python was conceived in the late 1980s and its implementation was started in December 1989.
2
• System programming
• Graphical User Interface Programming
• Internet Scripting
• Component Integration
• Database programming
• Gaming, Images, XML, Robot and more
Data Type
• Python has many native data types. Here are the important ones:
• Booleans are either True or False.
• Numbers can be integers (1 or 2), float (1.1 or 1.2), fractions (1/2 and 2/3) or even complex numbers.
• Strings are sequences of Unicode characters, e.g. an HTML document
• Bytes and byte array
• Lists
• Tuples
• Dictionary
Music Player Application using python
In our daily life, we see every person has a hobby and that is listening to music. So in
order to listen to music, they all need a Music player(hardware or software) where they
can play their favorite songs. And we have to install this music player on our computer,
based on the Operating system i.e Windows, Macintosh, Android, Linux, etc. Then we can
listen to our favorite songs.
Libraries used for Music Player Application:
Now we will tell you about the Libraries we will use in our code :
1. Tkinter
We had already told you in the title of this page that we are going to use the Tkinter library, which is a
standard library for GUI creation. The Tkinter library is most popular and very easy to use and it comes
with many widgets (these widgets help in the creation of nice-looking GUI Applications).
To use all the functions of Tkinter you need to import it in your code and the command for the same is:
Pygame is a Python module that works with computer graphics and sound libraries and is designed with the
power of playing with different multimedia formats like audio, video, etc. While creating our Music Player
application, we will be using Pygame's mixer.music module for providing different functionality to our music player
application that is usually related to the manipulation of the song tracks.
import pygame
Approach:-
def playsong(self):
self.track.set(self.playlist.get(ACTIVE))
# Displaying Status
self.status.set("-Playing")
pygame.mixer.music.load(self.playlist.get(ACTIVE))
pygame.mixer.music.play()
2.The stopsong() Function
def stopsong(self):
# Displaying Status
self.status.set("-Stopped")
# Stopped Song
pygame.mixer.music.stop()
3.The pausesong() Function
def pausesong(self):
# Displaying Status
self.status.set("-Paused")
# Paused Song
pygame.mixer.music.pause()
4.The unpausesong() Function
def unpausesong(self):
self.status.set("-Playing")
pygame.mixer.music.unpause()
Now here are some of the screenshots of our application:
The Folder named studytonight where the code file and folder for songs is placed looks like this:
Now the following screenshot is to show you how the application will look like:
Thank You