Category Archives: Python

Is related to the Python Programming language in some way

Python 201: Intermediate Python FREE until Wednesday!

I decided it would be fun to give my latest book away for free until this Wednesday, Oct 19th. So starting today, you can get Python 201: Intermediate Python free through Gumroad or Leanpub.

If you go with Gumroad, then you will need to use the following offer code: 201free. Note that if you want to receive updates to the book, you will want to create an account and add the book to your library.


PyDev of the Week: Glyph Lefkowitz

This week we welcome Glyph Lefkowitz (@glyph) as our PyDev of the Week! Glyph is the creator / maintainer of Twisted, an asynchronous event-driven networking engine. Glyph finds the time to write a blog that you might find quite interesting. You can also check out Github to see what projects he’s involved with. Let’s spend a few minutes getting to know Glyph better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m just this guy, you know?

I work on a lot of open source software, both for work – I maintain Twisted, and a ton of associated ecosystem projects, for Rackspace – and personally.

My hobbies mainly revolve around computers. For example, I’m an avid video game fan. I’ve also dabbled in graphic design, 3D rendering, and computer-generated music; although nothing really good enough to share. As time allows, I’m also a really big reader, particularly of science fiction and fantasy.

In summary, I’m a nerd in the classic sense. To complete the caricature, my wife is also a programmer and so my personal life revolves around computer technology as well. We both also have a strong interest in information security, so I spend a fair amount of time ensuring that our systems are up to date, our passwords are rotated, and so on.

Continue reading PyDev of the Week: Glyph Lefkowitz

How to Create a Diff of an Image in Python

For the past couple of years, I’ve been writing automated tests for my employer. One of the many types of tests that I do is comparing how an application draws. Does it draw the same way every single time? If not, then we have a serious problem. An easy way to check that it draws the same each time is to take a screenshot and then compare it to future versions of the same drawing when the application gets updated.

The Pillow library provides a handy tool for this sort of thing that is called ImageChops. If you don’t already have Pillow, you should go install it now so you can follow along with this short tutorial.

Comparing Two Images

The first thing we need to do is find two images that are slightly different. You can create your own by using burst mode on your camera and taking a bunch of photos of animals as they move, preferably while using a tripod. Or you can take an existing photo and just add some kind of overlay, such as text. I’m going to go with the latter method. Here is my original photo of Multnomah Falls in Oregon:


Continue reading How to Create a Diff of an Image in Python

PyDev of the Week: Paul Logston

This week we welcome Paul Logston (@PaulLogston) as our PyDev of the Week! Paul is the new maintainer for He took over for Will Kahn-Greene. You can read more about the transition here. He is also an organizer for his local Python Users Group. You might want to take a few moments to check out his Github profile so you can see what Paul has been up to. Let’s take some time to get to know him better!

Can you tell us a little about yourself (hobbies, education, etc):

Went to UC Davis for Chemical Engineering, studied improv in Chicago after college, studied as an EMT/Phlebotomist to work as one while doing comedy. Moved to New York, NY to continue doing comedy. Taught CPR/BLS/ACLS for a few years while doing comedy. Then decided to change careers. Decided to push for coding as I had done it all along as a hobby. After about a year of teaching myself Python, I moved from EMS education to working for 15Five as a developer. The NYC Python Meetup was integral in my Python education. Without that group, I wouldn’t be were I am today. I now help organize that group and run Saturday Office Hours along with some large talk nights and PyGotham; NYC’s regional Python conference. Other hobbies include binge watching Netflix originals, brewing kombucha, and teaching.

Continue reading PyDev of the Week: Paul Logston

An Intro to the Python Imaging Library / Pillow

The Python Imaging Library or PIL allowed you to do image processing in Python. The original author, Fredrik Lundh, wrote one of my favorite Python blogs when I first started learning Python. However PIL’s last release was way back in 2009 and the blog also stopped getting updated. Fortunately, there were some other Python folks that came along and forked PIL and called their project Pillow. The Pillow project is a drop-in replacement for PIL that also supports Python 3, something PIL never got around to doing.

Please note that you cannot have both PIL and Pillow installed at the same time. There are some warnings in their documentation that list some differences between PIL and Pillow that get updated from time to time, so I’m just going to direct you there instead of repeating them here since they will likely become out of date.

Install Pillow

You can install Pillow using pip or easy_install. Here’s an example using pip:

pip install Pillow

Note that if you are on Linux or Mac, you may need to run the command with sudo.

Opening Images


Pillow makes it easy to open an image file and display it. Let’s take a look:

from PIL import Image
image ='/path/to/photos/jelly.jpg')

Here we just import the Image module and ask it to open our file. If you go and read the source, you will see that on Unix, the open method saves the images to a temporary PPM file and opens it with the xv utility. On my Linux machine, it opened it with ImageMagick, for example. On Windows, it will save the image as a temporary BMP and open it in something like Paint.

Continue reading An Intro to the Python Imaging Library / Pillow

Python 101/201 Educational Giveaway

I think it’s very important for teens and college students to learn how to program. Science, Technology, Engineering and Mathematics is such a crucial set of topics to learn about that I have decided to give away copies of Python 101 and Python 201: Intermediate Python to teachers and professors starting today until 11:59 p.m. CST of October 14th, 2016.

Students with valid educational email addresses can also enter to get a free copy of the eBooks, but they will not be eligible for the paperbacks.

How to Get a Copy

Just leave a comment or contact me via my contact form and tell me why you want a copy. I do require some kind of proof that you’re an educator. If you can leave a comment or send me an email via the contact form using an official email address (such as an *.edu domain) or link me to some other proof (LinkedIn, your profile on a school website, etc), that would be great.


  • Everyone who enters with a valid educational email or other type of proof will receive am eBook copy of Python 101 and Python 201.
  • 5 lucky winners will get a copy of the paperback version of Python 201: Intermediate Python + the above
  • The Grand Prize will be a paperback copy of Python 101 and Python 201: Intermediate Python + the eBook copies


Get your comment or send in an email via the contact form before October 14th, 2016 at 11:59 p.m. CST and you will be entered. I’ll go through the entries and contact the winners.

PyDev of the Week: Bryan Van de Ven

This week we welcome Bryan Van de Ven (@bigreddot) as our PyDev of the Week! Bryan is a core developer of the Bokeh project, which is a visualization package for Python. He has also helped with the development of Anaconda. You can check out what projects he is a part of on Github. Let’s take a few moments to learn some more about our fellow Pythonista!

Can you tell us a little about yourself (hobbies, education, etc):

I currently work for Continuum Analytics in Austin, TX. I’ve been around there since day one, and helped with the development of Anaconda and the conda package manager early on. I’m very interested in the question of finding sustainable ways for companies to truly help and support open source and open source communities.

My educational path was a bit meandering. I studied Computer Science, then Physics and Mathematics at the University of Texas. I was lucky enough to have the opportunity to take classes from Dijkstra and Weinberg while I was there. Later, I went to grad school for Physics at UCLA, but (fortunately!) left the PhD program early. Fun fact: UC system diplomas have the Governor’s signature, so at the end of all that at least I got an Arnold Schwarzenegger autograph!

For relaxing, I cook, work out, travel when I can, and practice Portuguese. I also love going to “Master Pancake Theater” movie-mocking shows at the Alamo Drafthouse. Anyone who visits Austin should try to check them out:

Continue reading PyDev of the Week: Bryan Van de Ven

wxPython Cookbook Available for Pre-Order

I am excited to announce that the wxPython Cookbook is now available for Pre-Order. You can get your digital copy on Gumroad or Leanpub now. You can get a sample of the book on Leanpub if you’d like to “try before you buy”.

There will be over 50 recipes in this book. The examples in my book will work with both wxPython 3.0.2 Classic as well as wxPython Phoenix, which is the bleeding edge of wxPython that supports Python 3. If I discover any recipes that do not work with Phoenix, they will be clearly marked or there will be an alternative example given that does work.


Here is a partial listing of the current set of recipes in no particular order:

  • Adding / Removing Widgets Dynamically
  • How to put a background image on a panel
  • Binding Multiple Widgets to the Same Handler
  • Catching Exceptions from Anywhere
  • wxPython’s Context Managers
  • Converting wx.DateTime to Python datetime
  • Creating an About Box
  • How to Create a Login Dialog
  • How to Create a “Dark Mode”
  • Generating a Dialog from a Config File
  • How to Disable a Wizard’s Next Button
  • How to Use Drag and Drop
  • How to Drag and Drop a File From Your App to the OS
  • How to Edit Your GUI Interactively Using reload()
  • How to Embed an Image in the Title Bar
  • Extracting XML from the RichTextCtrl
  • How to Fade-in a Frame / Dialog
  • How to Fire Multiple Event Handlers
  • Making your Frame Maximize or Full Screen
  • Using wx.Frame Styles
  • Get the Event Name Instead of an Integer
  • How to Get Children Widgets from a Sizer
  • How to Use the Clipboard
  • Catching Key and Char Events
  • Learning How Focus Works in wxPython
  • Making Your Text Flash
  • Minimizing to System Tray
  • Using ObjectListView instead of ListCtrl

You can read more about the project in my Kickstarter announcement article. Please note that the Kickstarter campaign is over.

Related Posts

PyDev of the Week: Katie McLaughlin

This week we welcome Katie McLaughlin (@glasnt) as our PyDev of the Week! She is a core developer of the BeeWare project. You should take a moment and check out her Github profile to see what fun projects she’s a part of. Katie also has a fun little website and was a speaker at PyCon 2016. Let’s take a few moments to get to know her better!


Can you tell us a little about yourself (hobbies, education, etc):

G’day! I’m Australian, originally from Brisbane, but now living in Sydney. I’ve got a Bachelor of Information Technology, and I’ve been in the tech industry for going on ten years now. I’ve been in a bunch of different roles and technologies, but mostly in web hosting and cloud stuff. When I’m not on a computer or attending conferences, I enjoy cooking and making tapestries.

Why did you start using Python?

To fix a bug in a bit of in-house code! There was a bug in an old script, and I saw the “#!/usr/bin/env python” and learnt from there. I didn’t go back to Python for a few years, but just after I was accepted to PyCon Australia 2015, I thought I should brush up on what little I knew. That’s about a year ago now, and it’s now my go-to language for scripting. I was had previously used Ruby for years, and I only occasionally still automatically type “puts” instead of “print”.

Continue reading PyDev of the Week: Katie McLaughlin

PyDev of the Week: Benedikt Eggers

This week we welcome Benedikt Eggers (@be_eggers) as our PyDev of the Week. Benedikt is one of the core developers working on the IronPython project. IronPython is the version of Python that is integrated with Microsoft’s .NET framework, much like Jython is integrated with Java. If you’re interesting in seeing what Benedikt has been up to lately, you might want to check out his Github profile. Let’s take a few minutes to get to know our fellow Pythoneer!

Could you tell us a little about yourself (hobbies, education, etc):

My name is Benedikt Eggers and I was born and live in Germany (23 years). I’ve working as a software developer and engineer and had studied business informatics. At my little spare time I do sports and work on open source projects, like IronPython.

Why did you start using Python?

To be honest, I’ve started using Python by searching for a script engine for .net. That way I came to IronPython and established it in our company. There we are using it to extend our software and writing and using Python modules in both worlds. After a while I got more into Python and thought that’s a great concept of a dynamic language. So it’s a good contrast to C#. It is perfect for scripting and other nice and quick stuff.

Continue reading PyDev of the Week: Benedikt Eggers