S6 CS Programme Elective
CST362 Programming in Python
Module 3
Overview of Turtle Graphics
Some attributes of a Turtle
Turtle
Methods
Turtle
Methods
>>> from turtle import Turtle
>>> t = Turtle()
Draw T shape
>>> from turtle import Turtle
>>> t = Turtle()
Draw Square
Image Processing
Sampling and Digitizing Images
Sampling and Digitizing Images
Image File Formats
Image File Formats
Image File Formats
Image File Formats
Image File Formats
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Image-Manipulation Operations
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The Properties of Images
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The images Module
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The images
Module
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The images
Module
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The images
Module
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
The images
Module
>>> image.save("horizontal.gif")
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Image Grid
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Image Grid
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Color Image to black & white
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Color Image to Grayscale
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Copying an image
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Image Blurring
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Blurring an image
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Edge Detection
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Edge Detection
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Reducing image size
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Graphical User Interfaces
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Graphical User Interfaces
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Graphical User Interfaces
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Window Components
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Title bar
Command buttons
Labels
Command button
Entry fields
Graphical User Interfaces
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Event Driven Programming
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Template for GUI
Programs
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Template for GUI
Programs
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Window
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
EasyFrame.__init__(self, width = 300, height = 200, title = "Label Demo")
Another way to change a window’s attributes is to reset them in the window’s attribute dictionary
In the labeldemo’s __init__ method,
self[“background”]=”yellow”
Window
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition
Ref. Kenneth A Lambert, Fundamentals of first python programs, 2nd edition