0% found this document useful (0 votes)
77 views31 pages

UNIT 5 Dr. JPSM PPT - Python

This document provides an overview of Python programming including course objectives, outcomes, and syllabus. The objectives are to study object oriented programming in Python, develop skills using Python, and familiarize with its functionality and applications. The outcomes include understanding object oriented paradigms in Python and using Python for IO, text processing, and more. The syllabus covers topics like GUI, event-driven programming, multithreading, networks, and client-server programming.

Uploaded by

morenikhil2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views31 pages

UNIT 5 Dr. JPSM PPT - Python

This document provides an overview of Python programming including course objectives, outcomes, and syllabus. The objectives are to study object oriented programming in Python, develop skills using Python, and familiarize with its functionality and applications. The outcomes include understanding object oriented paradigms in Python and using Python for IO, text processing, and more. The syllabus covers topics like GUI, event-driven programming, multithreading, networks, and client-server programming.

Uploaded by

morenikhil2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Python Programming

(CSE3011, LP, 03)

Dr. JITENDRA P S MATHUR (100526)


Assistant Professor Grade-I,
School of Computing Science and Engineering,
VIT Bhopal University, Bhopal
Course Objectives
This course will introduce the Python Programming
language, its functionality, code constructs, and its
applications. This course is devised for following
objectives.

1. To study object oriented paradigm in Python.


2. To develop their skill set using Python.
3. To familiarize with the functionalities and applications
of Python
Course Outcomes

• Understand and use the Object Oriented paradigm in


Python.

• Use the IO model in Python to read and write disk files.

• Write Python programs using collections, regular


expression, classifying and categorizing text.
Student Outcomes (SO)
1. An ability to analyze a problem, identify and define the
computing requirements appropriate to its solution.
2. An ability to design, implement and evaluate a system
/computer‐based system, process, component or program
to meet desired needs
3. Design and conduct experiment as well as analyze and
interpret data.
4. An ability to use current techniques, skills and tools
necessary for computing engineering practice.
5. An ability to apply mathematical foundations, algorithmic
principles and computer science theory in the modeling
and design of computer-based systems (CS)
Syllabus
Continue…
List of Experiments
Unit-V
• Graphical user interfaces, event-driven
programming paradigm, tkinter module,
creating simple GUI, buttons, labels, entry fields,
dialogs, widget attributes - sizes, fonts, colors
layouts, nested frames, Multithreading,
Networks, and Client/Server Programming,
introduction to HTML, interacting with remote
HTML server, running html-based queries,
downloading pages; CGI programming,
programming a simple CGI form
Introduction
• A graphical user interface is an application that has buttons,
windows, and lots of other widgets that the user can use to
interact with your application.
• A good example would be a web browser. It has buttons,
tabs, and a main window where all the content loads.
• In GUI programming, a top-level root windowing object
contains all of the little windowing objects as text labels,
buttons, list boxes, etc. that will be part of your complete
GUI application.
• User Interface is the space where interactions between you
and the computer hardware.
• Python offers multiple options for developing GUI
(Graphical User Interface). The most commonly used GUI
method is tkinter.
GUI Visualization
TERMINOLOGIES
• Window – it is a rectangular zone on computer screen.
• Top-level window - is an independent window within an
application. One application may have many top level
windows.
• widget - the general word for visual building blocks to
interact an Activityin GUI.
• Layouts -The way you arrange the widgets in a GUI.
• Frame - Rectangular area which contains other widgets to
organize different layouts.
• Parent, child – A relationship of parent and child is
created for any crated widget. For example, when a check
button placed on a frame, frame becomes parent and check
button becomes child.
Packages
• There are many tool kit options available for developing graphical
user interface (GUI) . Most popular are given below:

1. Tkinter - GUI toolkit given with python is Tkinter. All the other
GUI tool kits for python can be used as alternatives to the Tkinter.
2. PyGTK – permits to write GTK programs in python and has a lot
of widegets than Tkinter.
3. PyQT – is a set of python software libraries for Qt Framework.Qt
is an extensive C++ GUI application development framework that
is available for Unix, Windows and Mac OS X.
4. wxPython – is a set of python software libraries to create
wxWidgets.
5. Kivy – is an open source cross platform for developing mobile
apps using python. Mobile apps can be developed for andriod,
iOS, linux and windows.
Tkinter Package
• It is Python's standard GUI (Graphical User Interface)
package. It is the most commonly used toolkit for GUI
Programming in Python.
• Tkinter is the Python interface to Tk (Tea Kay), it can be
pronounced as Tea-Kay-inter. i.e tkinter = t k inter.
• Python provides the standard library tkinter for creating
the graphical user interface for desktop based
applications.
• Developing desktop based applications with tkinter is
not a complex task.
Import tkinter
A Tkinter window application can be created by
using the following steps.

1. Import the tkinter module.


2. Create the main application window.
3. Add the widgets like labels, buttons, frames, etc.
to the window.
4. Call the main event loop so that the actions can
take place on the user's computer screen.
Creating GUI using Tkinter
• #/user/bin/python (Self executing script)
• import tkinter as tk1 (Import Tkinter library )
• tp=tk1.Tk() (Tkinter Tk window is assigned to top)
• # Codes for widgets (Comment)
• tp.mainloop() (Main loop is started and waiting for
mouse and key board actions)
Tkinter Widgets
• Widget is a graphical user interface controls to interact
between user and computer. Tkinter gives different types
of controls such as buttons, labels and text boxes used in
a GUI application.
Continue…
Using Button widget in window
• Function or a method can be attached to a button which
is called automatically when the button is clicked.

• Parameters:

• master: Parent window


• options: Options are listed in the Following table.

Syntax- w = Button ( master, option=value, ... )


Table
Work with button
#!/usr/bin/python
import Tkinter as tk
import tkMessageBox as bx
tp=tk.Tk()
def exbutton():
bx.showinfo("Python button example","Hello World")
B=tk.Button(tp,text="Press this
button",command=exbutton)
B.pack()
tp.mainloop()
tp.mainloop()
Using Entry widget in window
• Single line text strings can be entered using entry widget.
Text widget can be used to enter multiple lines and label
widget is used to display one or more lines of text but
cannot edit.

• Parameters:

• master: the parent window.


• options: : List of ususally used options are given below

Syntax-w = Entry( master, option, ... )


Continue…
Example
• from Tkinter import *
• tp=Tk()
• la1=Label(tp,text="User ID")
• la1.pack(side=LEFT)
• en1=Entry(tp,bd=6)
• en1.pack(side=RIGHT)
• tp.mainloop()
Using Label widget in window
• This widget implements a display box where you can
place text or images. The text displayed by this widget
can be updated at any time you want.

• Syntax w = Label ( master, option, ... )

• Parameters master: This represents the parent window.


• options: Here is the list of most commonly used options
for this widget. These options can be used as key-value
pairs separated by commas.
Example
• import Tkinter as tk
• m=tk.Tk()
• tk.Label(m,text='First',bg="red").grid(row=0,col
umn=0)
• tk.Label(m,text='Second',bg="blue").grid(row=0
,column=1)
• tk.Label(m,text='Third',bg="green").grid(row=1,
column=0)
• m.mainloop()
Multithreading
• It is a way of achieving multitasking. In
multithreading, the concept of threads is used.
• A thread is a sequence of such instructions within
a program that can be executed independently of
other code.
Any process has 3 basic components:
1. An executable program.
2. The associated data needed by the program
(variables, workspace, buffers, etc.)
3. The execution context of the program (State of
the process)
How to achieve multithreading in Python?

• There are two main modules of multithreading used to


handle threads in Python.
• The thread module
• The threading module

Thread modules
• It is started with Python 3, designated as obsolete, and
can only be accessed with _thread that supports
backward compatibility.
• Syntex-
thread.start_new_thread ( function_name, args[, kwarg
s] )
Introduction to HTML
• HTML stands for HyperText Markup Language.
It is used to design web pages using a markup
language. HTML is a combination of Hypertext
and Markup language. Hypertext defines the link
between web pages.
THANKS

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy