Python’s with Statement and Context Managers

Python came out with a special new keyword several years ago in Python 2.5 that is known as the with statement. This new keyword allows a developer to create context managers. But wait! What’s a context manager? They are handy constructs that allow you to set something up and tear something down automatically. For example, […]

Python’s with Statement and Context Managers Read More »

Python 201: The functools Module (Video)

I recently did a talk on Python’s neat functools module. This screencast covers the majority of the module: Caching cache lru_cache total_ordering partial reduce singledispatch wraps   Related Reading Mouse Vs Python – Partial Functions Real Python: Python’s reduce(): From Functional to Pythonic Style Mouse Vs Python – Function Overloading with singledispatch Mouse Vs Python

Python 201: The functools Module (Video) Read More »

Python GUI Frameworks (Video)

In this tutorial, I talk about some of Python’s most popular GUI frameworks. You will learn the basics of graphical user interfaces. Then you will learn how to create a simple image viewer using wxPython. Finally, you will see how to rewrite the image viewer using PySimpleGUI. Related Reading Creating an Image Viewer with PySimpleGUI

Python GUI Frameworks (Video) Read More »

PySimpleGUI – How to Draw Shapes on an Image with a GUI

Drawing shapes on images is neat. But wouldn’t it be nice if you could draw the shapes interactively? That is the point of this tutorial. You will create a user interface using PySimpleGUI to allow you to draw shapes on images! The purpose of this user interface is to show you how you can make

PySimpleGUI – How to Draw Shapes on an Image with a GUI Read More »

Drawing Shapes on Images with Python and Pillow

Pillow provides a drawing module called ImageDraw that you can use to create simple 2D graphics on your Image objects. According to Pillow’s documentation, “you can use this module to create new images, annotate or retouch existing images, and to generate graphics on the fly for web use.” If you need more advanced drawing capabilities

Drawing Shapes on Images with Python and Pillow Read More »