Nothing Special   »   [go: up one dir, main page]

What Is Python?

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

What is Python?

Executive
Summary
Python is an interpreted, object-oriented, high-level
programming language with dynamic semantics. Its high-
level built in data structures, combined with dynamic typing
and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or
glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability
and therefore reduces the cost of program maintenance.
Python supports modules and packages, which encourages
program modularity and code reuse. The Python interpreter
and the extensive standard library are available in source
or binary form without charge for all major platforms, and
can be freely distributed.

Often, programmers fall in love with Python because of the


increased productivity it provides. Since there is no
compilation step, the edit-test-debug cycle is incredibly fast.
Debugging Python programs is easy: a bug or bad input will
never cause a segmentation fault. Instead, when the
interpreter discovers an error, it raises an exception. When
the program doesn't catch the exception, the interpreter
prints a stack trace. A source level debugger allows
inspection of local and global variables, evaluation of
arbitrary expressions, setting breakpoints, stepping through
the code a line at a time, and so on. The debugger is written
in Python itself, testifying to Python's introspective power.
On the other hand, often the quickest way to debug a
program is to add a few print statements to the source: the
fast edit-test-debug cycle makes this simple approach very
effective.

Libraries in Python
Normally, a library is a collection of books or is a room or
place where many books are stored to be used later.
Similarly, in the programming world, a library is a
collection of precompiled codes that can be used later on in
a program for some specific well-defined operations. Other
than pre-compiled codes, a library may contain
documentation, configuration data, message templates,
classes, and values, etc.
A Python library is a collection of related modules. It
contains bundles of code that can be used repeatedly in
different programs. It makes Python Programming simpler
and convenient for the programmer. As we don’t need to
write the same code again and again for different
programs. Python libraries play a very vital role in fields of
Machine Learning, Data Science, Data Visualization, etc.
Normally, a library is a collection of books or is a room or
place where many books are stored to be used later.
Similarly, in the programming world, a library is a
collection of precompiled codes that can be used later on in
a program for some specific well-defined operations. Other
than pre-compiled codes, a library may contain
documentation, configuration data, message templates,
classes, and values, etc.
A Python library is a collection of related modules. It
contains bundles of code that can be used repeatedly in
different programs. It makes Python Programming simpler
and convenient for the programmer. As we don’t need to
write the same code again and again for different
programs. Python libraries play a very vital role in fields of
Machine Learning, Data Science, Data Visualization, etc.
Python offers multiple options for developing GUI
(Graphical User Interface). Out of all the GUI methods,
tkinter is the most commonly used method. It is a standard
Python interface to the Tk GUI toolkit shipped with Python.
Python with tkinter is the fastest and easiest way to create
the GUI applications. Creating a GUI using tkinter is an
easy task.
To create a tkinter app:
1. Importing the module – tkinter
2. Create the main window (container)
3. Add any number of widgets to the main window
4. Apply the event Trigger on the widgets.
Importing tkinter is same as importing any other module in
the Python code. Note that the name of the module in
Python 2.x is ‘Tkinter’ and in Python 3.x it is ‘tkinter’.
import tkinter
There are two main methods used which the user needs to
remember while creating the Python application with GUI.
1. Tk(screenName=None,   baseName=None,
className=’Tk’,   useTk=1):  To create a main window,
tkinter offers a method ‘Tk(screenName=None,
baseName=None,   className=’Tk’,   useTk=1)’. To
change the name of the window, you can change the
className to the desired one. The basic code used to
create the main window of the application is:
m=tkinter.Tk() where m is the name of the main window
object
2. mainloop():  There is a method known by the name
mainloop() is used when your application is ready to
run. mainloop() is an infinite loop used to run the
application, wait for an event to occur and process the
event as long as the window is not closed.
m.mainloop()

import tkinter

m = tkinter.Tk()

'''

widgets are added here

'''

m.mainloop()

tkinter also offers access to the geometric configuration of


the widgets which can organize the widgets in the parent
windows. There are mainly three geometry manager
classes class.

You might also like