Project Document22
Project Document22
On
MUSIC PLAYER USING PYTHON TKINTER
2023-2024
CHRISTU JYOTHI INSTITUTE OF TECHNOLOGY AND SCIENCE
NBA & NAAC Accredited, Permanently Affiliated to JNTUH
CERTIFICATE
This is to certify that the report entitled ON “ MUSIC PLAYER USING PYTHON
TKINTER” is submitted to State Board Of Technical Education and Training,
Hyderabad by T.SUNILKUMAR(21486-EC-030) , K.SHIVA PRASAD(21486-EC-
036), Y.GAUTHAM(21486-EC-O39), J.KARTHIK(21486-EC-031), R.VIKRAM
TEJA(21486-EC-023). of final year Diploma in ELECTRONICS
&COMMUNICATION ENGINEERING (2023-2024) in partial fulfillment for the
requirements of the degree of Diploma in ELECTRONICS &COMMUNICATION
ENGINEERING is a Bonafied record of work done by them under my Supervision
and Guidance
We are heartily thankful to the Director Rev. Fr.D.VIJAYA PAUL REDDY, for giving this
opportunity.
We take this opportunity to express our sincere thanks to our project guide, Vice-Principal ,
Mr.P.THIRUPATHI for his exemplary guidance and monitoring throughout the course of
this project. Without the help and guidance given by him time to time, we couldn’t have
completed the project.
We would like to express our special gratitude and thanks to all who extended their
helping hand in accomplishment of the project.
Thanking you,
Python – History:
Python 1.0
In January 1994, version 1.0 was released, armed with functional programming tools,
features like support for complex numbers etc.
Python 2.0
Next major version − Python 2.0 was launched in October 2000. Many new features
such as list comprehension, garbage collection and Unicode support were included with
it.
Python 3.0
Python 3.0, a completely revamped version of Python was released in December 2008.
The primary objective of this revamp was to remove a lot of discrepancies that had
crept in Python 2.x versions. Python 3 was backported to Python 2.6. It also included a
utility named as python2to3 to facilitate automatic translation of Python 2 code to
Python 3.
Current Version
Meanwhile, more and more features have been incorporated into Python's 3.x branch.
As of date, Python 3.11.2 is the current stable version, released in February 2023.
STEP 1: Go to python.org/downloads.
STEP 2: Choose the version suitable for your operating system (windows,macOS,or
Linux) and download the installer.
STEP 3: Double-click the downloaded file and follow the installation instructions.
STEP 4: During the installation process, you can customize the installation location
and add python to your system’s PATH.
STEP 5: Open a command prompt(on windows) or a terminal(on macOS or Linux).
You should see the version number displayed.
STEP 6 : Once the installation is complete, you can launch PyCharm from the Start
menu (Windows) or the Applications folder (macOS/Linux).
PYTHON-FEATURES:
3.Easy to Learn
Compared to C++, Python has a simpler syntax. Its code is more readable. Writing C++
code seems daunting in the beginning because of complicated syntax rule such as use of
curly braces and semicolon for sentence termination.
4.Python is Interactive
Standard Python distribution comes with an interactive shell that works on the
principle of REPL (Read − Evaluate − Print − Loop). The shell presents a Python
prompt >>>. You can type any valid Python expression and press Enter. Python
interpreter immediately returns the response and the prompt comes back to read the
next expression.
5.Portability
Python code is easily portable from one OS to other. C++ code is not portable as it must be
recompiled if the OS changes.
6.Python is Extensible
The term extensibility implies the ability to add new features or modify existing features. As
stated earlier, CPython (which is Python's reference implementation) is written in C. Hence
one can easily write modules/libraries in C and incorporate them in the standard library.
There are other implementations of Python such as Jython (written in Java) and IPython
(written in C#). Hence, it is possible to write and merge new functionality in these
implementations with Java and C# respectively.
PYTHON-APPLICATIONS:
1.Web Development:
Frameworks like Django and Flask are popular for building web applications.
Python is used for both server-side logic and scripting in web development.
6.Game Development:
Pygame is a popular library for developing simple games using Python.
9.Cybersecurity:
Python is used in cybersecurity for tasks like penetration testing, scripting, and building
security tools.
2.Versatility:
Python is a versatile language suitable for a wide range of applications,
from web development to scientific computing.
5.Cross-Platform Compatibility:
Python is compatible with major operating systems, allowing developers to
write code that runs seamlessly on different platforms.
6.Integration Capabilities:
Python can easily integrate with other languages like C and C++, enabling
developers to use existing code and libraries.
DISADVANTAGES OF PYHTON:
1.Performance:
Python can be slower compared to languages like C or C++ due to its interpreted
nature. However, for many applications, the performance difference is negligible.
3.Mobile Development:
While Python is used in mobile development (e.g., with frameworks like Kivy or
BeeWare), it may not be as dominant as languages like Swift for iOS or Kotlin for
Android.
5.Design Restrictions:
The enforced indentation and whitespace requirements can be a point of contention for
developers who prefer more flexible formatting.
PURPOSED METHOD
1. Tkinter :-
Tkinter is a Python library for creating graphical user interfaces (GUIs). It comes
bundled with most Python installations and provides tools for creating windows,
buttons, labels, and other GUI elements.
2. fnmatch :-
fnmatch is a Python module used for Unix-style filename pattern matching. It provides
a function, also called fnmatch, that checks whether a given filename matches a
specified pattern containing wildcards like '*' and '?'. It's often used for tasks such as
filtering files based on patterns.
3. OS :-
The os module in Python provides a way of interacting with the operating system. It
includes functions for tasks such as file and directory manipulation, environment
variable access, and process management.
various operating systems (os) such as Windows, macOS, and Linux etc.
4. Pygame :-
Pygame is a set of Python modules designed for writing video games. It builds on top of
the Simple DirectMedia Layer (SDL) library and provides functionalities for handling
graphics, sound, input devices, and more.
Input Handling: You can capture user input, such as keyboard and mouse
events.
Event Handling: Pygame provides a way to handle events like mouse clicks and
keypresses.
Sprites: Sprite handling simplifies working with game entities.
5. Mixer :-
A "mixer" could refer to a module or library used for audio processing or mixing
sounds. One commonly used library for this purpose is pygame.mixer. It allows you to
work with sound effects and music in your Python programs.
This module is part of the Pygame library, which is used for game development in
Python. The pygame.mixer module specifically deals with mixing and playing sounds in
games.
6. Canvas :-
A "canvas" typically refers to a graphical drawing area or surface provided by a
graphical user interface (GUI) library. One commonly used GUI library is tkinter, and
it includes a Canvas widget.
The Canvas widget in tkinter allows you to draw various shapes, text, and images on a
designated area within a GUI. It provides a versatile space for creating graphical
elements and interactive visuals in your Python programs.
7. rootpath :- A common approach is to use the os module to navigate the file system
and determine the current working directory or the directory of the script being
executed.
8. init( ) :-
The initialization method in a class. It is a special method that gets called when an
object of the class is instantiated. This method is commonly used to initialize the
attributes of the object.
9. Label:
Tkinter Label is a widget that is used to implement display boxes where you can place
text or images. The text displayed by this widget can be changed by the developer at any
time you want. It is also used to perform tasks such as to underline the part of the text
and span the text across multiple lines. It is important to note that a label can use only
one font at a time to display text. To use a label, you just have to specify what to display
in it (this can be text, a bitmap, or an image).
Syntax:
w = Label ( master, option, … )
10. def :-
Python def keyword is used to define a function, it is placed before a function name that
is provided by the user to create a user-defined function. In Python, a function is a
logical unit of code containing a sequence of statements indented under a name given
using the “def” keyword. In Python def keyword is the most used keyword.
• In the case of classes, the def keyword is used for defining the methods of a class.
• def keyword is also required to define the special member function of a class like
_init_().
The possible practical application is that it provides the feature of code reusability
rather than writing the piece of code again and again we can define a function and write
the code inside the function with the help of the def keyword. It will be more clear in the
illustrated example given below. There can possibly be many applications of def
depending upon the use cases.
11. Listbox :-
A Listbox is a widget commonly used in graphical user interface (GUI) libraries to
display a list of items. One popular GUI library is tkinter, and it includes a Listbox
widget.
12. Anchor :-
Anchors are used to define where text is positioned relative to a reference point.
Here is list of possible constants, which can be used for Anchor attribute.
NW
N
NE
W
CENTER
E
SW
S
SE
13. TEXT :-
The Text widget is used to display text in multiple lines.
14. If Else :-
you can use the if, elif (optional), and else statements to implement conditional logic.
The if statement alone tells us that if a condition is true it will execute a block of
statements and if the condition is false it won’t. But if we want to do something else if
the condition is false, we can use the else statement with the if statement to execute a
block of code when the if condition is false.
15. pack( ) :-
In Tkinter, pack() is a geometry manager method used to organize widgets in blocks
before placing them in the parent widget. It is commonly used to control how widgets
are displayed within a container.
Compared to the grid manager, the pack manager is somewhat limited, but it’s much
easier to use in a few, but quite common situations:
Put a widget inside a frame (or any other container widget), and have it fill the
entire frame
Place a number of widgets on top of each other
Place a number of widgets side by side
16. padx :-
The padx is nothing but padding inside the layout, X indicates the x axis. The elements
inside the layout tells that it needs more space inside the layout than what is allocated.
17. pady :-
The pady is nothing but padding inside the layout, Y indicates the y axis.Add external
padding to the left and right of the widget.
18. Grid( ) :-
The Grid geometry manager puts the widgets in a 2-dimensional table. The master
widget is split into a number of rows and columns, and each “cell” in the resulting
table can hold a widget. The grid manager is the most flexible of the geometry
managers in Tkinter.
Using the grid manager is easy. Just create the widgets, and use the grid method to tell
the manager in which row and column to place them.
19. List insert() :-
List insert() method in Python is very useful to insert an element in a list. It is used in
editing lists with huge amount of data, as inserting any missed value in that list is made
very easy with this Python function.
20. Frame :-
21. Buttons :-
The Button widget is used to add buttons in a Python application. These buttons can
display text or images that convey the purpose of the buttons. You can attach a function
or a method to a button which is called automatically when you click the button.
22. Scale :-
It is used to provide a graphical slider that allows to select any value from that scale.
The general syntax is:-
w = Scale(master, option=value)
master is the parameter used to represent the parent window.
There are number of options which are used to change the format of the widget.
Number of options can be passed as parameters separated by commas. Some of them
are listed below.
cursor: To change the cursor pattern when the mouse is over the widget.
Activebackground: To set the background of the widget when mouse is over the
widget.
23. Command :-