Python Project
Python Project
PROJECT
(5th semester 2018)
------ Auliq-Ice
As I begin to reflect on the magnitude of my project report, I am reminded of all the support, help
and encouragement provided to me by the members of R&D Planning Team as without their support
my project wouldn’t be ongoing. I thank the persons who inspired me to work and promoted this
unique way of learning around their surroundings. When I begin to put on paper the feelings I have
towards the people who have changed my heart, soul and thought, I am overwhelmed with emotions.
If I put it in real terms, I would call it a splendid team effort that has helped me to end my training on
high notes. My experience here has been very enriching. I sincerely hope that their guidance would be
of great help to me for the rest of the project. I show my gratitude and thankfulness:-
• To the Technical Officer for his vision, integrity and sense of qualitywhich is truly uncommon. It is
only due to his penetrating sight that my inner talent
was unveiled and has given me the confidence to face the competitive world. During my highs and lows
his words of wisdom have always been a source of inspiration forme. I am eternally grateful to you sir.
• To Ms.Shruty Ahuja for her wise and synergistic help. Her sense of responsibility, logical way of
treating situation and vision is worth of being exemplified.
DECLARATION
I hereby declare that the project work entitled “MUSIC PLAYER” is an authentic
Industrial Training semester for the award of degree of B.TECH. (Computer Science &
SALONI ARORA
CSE/5th sem/41555102716
Date: 31-08-2018
It is certified that the above statement made by the student is correct to the best of our
HOD(CSE), MVSIT
ABSRACT
The Music Player was made using the basic knowledge of python and
by using its internal library class called Tkinter , using this library module the
GUI (Graphical User Interface) can be created which includes various buttons
dropdown menus and various toggle buttons etc. Python offers multiple options
for developing GUI (Graphical User Interface). Out of all the GUI methods,
Tk GUI toolkit shipped with Python. Python with tkinter outputs the fastest and
easiest way to create the GUI applications. Creating a GUI using tkinter is an
easy task. Tkinter, a module in the Python standard library which fills in as an
user input and output. GUIs often use a form of object oriented programming
which we call event-driven: the program responds to events, which are actions
that a user takes. Tkinter provides us with a variety of common GUI elements
which we can use to build our interface – such as buttons, menus and various
kinds of entry fields and display areas Tkinter’s, it is fast, and that it usually
comes bundled with Python. The combined coding and the tkinter class from
the python helped me in making the desired GUI I wanted to make for the Music Player.
CONTENT
S.No. TITLE
1. Acknowledgement
2. Certificate
3. Declaration
4. Preface
5. Organisation introduction
6. Introduction to python programming
7. Introduction to gui programming
8. Literature review
9. Program and result (source code)
10. Conclusion
11. Bibliography
INTRODUCTION TO PYTHON PROGRAMMING
Python is a dynamic, object-oriented programming language that can be used for many kinds of
software development. It offers strong support for integration with other languages and tools, comes
with extensive standard libraries, and can be learned in a few days.
What is Python?
Python is a popular programming language. It was created in 1991 by Guido van Rossum.
It is used for:
Good to know
Python was designed to for readability, and has some similarities to the
Python relies on indentation, using whitespace, to define scope; such as the scope of loops,
functions and classes. Other programming language often use curly-brackets for this purpose.
INTRODUCTION TO GUI PROGRAMMING
Tkinter is the Python interface to the Tk GUI toolkit shipped with Python. There are
other Python interfaces like wxPython and jPython. wxPython is an open-source Python
interface for wxWindows. JPython is a Python port for Java which gives Python scripts seamless
access to Java class libraries on the local machine. But the most popular among these three are
Tkinter .
Tk is called Tkinter in Python, or to be precise, Tkinter is the Python interface for Tk.
Tk was developed as a GUI extension for the Tcl scripting language by John Ousterhout. The
first release was in 1991. Tk proved as extremely successful in the 1990’s, because it is easier to
learn and to use than other toolkits.
Tkinter is the standard GUI library for Python .Python when combined with combined with
Tkinter provides a fast and easy way to create GUI applications .
Creating a GUI application using Tkinter is an easy task. It can be done with the following steps.
4.Enter the main event loop to take action against each event triggered by the user.
LITERATURE REVIEW
The Code:-
import os
import mutagen
root = Tk()
root.minsize(300,300)
listofsongs = []
realnames = []
v = StringVar()
songlabel = Label(root,textvariable=v,width=35)
index = 0
def directorychooser():
directory = askdirectory()
os.chdir(directory)
if files.endswith(".mp3"):
realdir = os.path.realpath(files)
audio = ID3(realdir)
realnames.append(audio['TIT2'].text[0])
listofsongs.append(files)
mutagen.mixer.init()
mutagen.mixer.music.load(listofsongs[0])
mutagen.mixer.music.play()
directorychooser()
def updatelabel():
global index
global songname
v.set(realnames[index])
#return songname
def nextsong(event):
global index
index += 1
mutagen.mixer.music.load(listofsongs[index])
mutagen.mixer.music.play()
updatelabel()
def prevsong(event):
global index
index -= 1
mutagen.mixer.music.load(listofsongs[index])
mutagen.mixer.music.play()
updatelabel()
def stopsong(event):
mutagen.mixer.music.stop()
v.set("")
#return songname
label = Label(root,text='Music Player')
label.pack()
listbox = Listbox(root)
listbox.pack()
#listofsongs.reverse()
realnames.reverse()
listbox.insert(0,items)
realnames.reverse()
#listofsongs.reverse()
nextbutton.pack()
previousbutton = Button(root,text = 'Previous Song')
previousbutton.pack()
stopbutton.pack()
nextbutton.bind("<Button-1>",nextsong)
previousbutton.bind("<Button-1>",prevsong)
stopbutton.bind("<Button-1>",stopsong)
songlabel.pack()
root.mainloop()
RESULT:-
EXPLANATION:-
fg=foreground color
bg=background color
theLabel.pack()
2> BUTTONS
fromtkinter import*
root=Tk()
nextbutton.pack()
previousbutton = Button(root,text = 'Previous Song')
previousbutton.pack()
stopbutton.pack()
nextbutton.bind("<Button-1>",nextsong)
previousbutton.bind("<Button-1>",prevsong)
stopbutton.bind("<Button-1>",stopsong)
songlabel.pack()
def directorychooser():
directory = askdirectory()
os.chdir(directory)
realdir = os.path.realpath(files)
audio = ID3(realdir)
realnames.append(audio['TIT2'].text[0])
listofsongs.append(files)
mutagen.mixer.init()
mutagen.mixer.music.load(listofsongs[0])
mutagen.mixer.music.play()
directorychooser()
3> MUTAGEN
Import mutagen
\\metadata = mutagen.[format].Open(filename)
\\A FileType is used to represent container formats which contain audio/video and tags.
In some cases, like MP4, the tagging format and the container are inseparable, while in
other cases, like MP3, the container does not know about tags and the metadata is loosely
attached to the file.
4> LISTBOX
listbox = Listbox(root)
istbox.pack()
#listofsongs.reverse()
realnames.reverse()
listbox.insert(0,items)
realnames.reverse()
#listofsongs.reverse()
alternatives. The listbox can only contain text items, and all items must have
the same font and color. Depending on the widget configuration, the user can
how the listbox is configured, the user can select one or many items from that
list.
6> LABEL
theLabel=label(root,text="This is too easy")
theLabel.pack()
root.mainloop()
The label is a widget that the user just views but not interacts with. The
Also possible to underline part of the text like to identify a keyboard shortcut
\\Tkinter provides various controls, such as buttons, labels and text boxes used in
GUI application. These controls are commonly called widgets. There are several types of
widgets in Tkinter. Each one will be illustrated in detail. It various top level windows and
geometry managers .
RESULT:-
Screenshots-
In this project I learned about how to create a GUI or Graphical User Interface
using python language. Since, python has many inbuilt libraries and functions.
I could use one class, called the Tkinter class to help me create the GUI for my
project Music Player, amongst the huge collection of libraries and classes in
python. Python is easy to write and understand language which does not require
any special training to recognize of what is going on in the code. A rookie who
doesn’t even know much about programming can get an idea of what the
program is about, by just reading the lines of python code as like reading a
that can be used for many kinds of software development. It offers strong
support for integration with other languages and tools, comes with extensive
https://www.blog.pythonlibrary.org/2010/04/20/wxpython-creating-a-simple-mp3-player/
https://github.com/libpd/pd-for-android
https://www.youtube.com/watch?v=hm7L31bdx6g