Entries tagged with “Python”.

I was recently approached by the author of the free eBook, Intermediate Python by Muhammad Yasoob Ullah Khalid to review his work. Yasoob is the fellow behind the Python Tips blog. The book has been released as open source on Github but can be downloaded as a PDF from ReadTheDocs. But before I go into too much detail about the book, here’s my quick review:

Quick Review

  • Why I picked it up: I was asked by the author to read the book.
  • Why I finished it: I read through a lot of the book and skimmed the rest, actually
  • I’d give it to: A beginner who wants to learn a bit more about the Python language


This week we welcome Kenneth Love as our PyDev of the Week. He is active in the Python community via the Portland chapter of Django Ladies. He works for Team Treehouse creating Python courses. Let’s spend some time getting to know him better.


This week we welcome Melanie Crutchfield as our PyDev of the week! Let’s spend some time getting to know her better!



I was recently looking into ways to get my screen resolution with Python to help diagnose an issue with an application that wasn’t behaving correctly. In this article, we’ll look at some of the ways to get your screen resolution. Not all of the solutions will be cross-platform, but I’ll be sure to mention that fact when I discuss those methods. Let’s get started!

Using the Linux Command Line

There are several ways to get your screen resolution in Linux. If you do a Google search, you’ll see people using various Python GUI toolkits. I wanted to find a way to get the screen resolution without installing a third party module. I eventually found the following command:

xrandr | grep '*'

I then had to take that information and translate it into Python. Here’s what I came up with:

import subprocess
cmd = ['xrandr']
cmd2 = ['grep', '*']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
p2 = subprocess.Popen(cmd2, stdin=p.stdout, stdout=subprocess.PIPE)
resolution_string, junk = p2.communicate()
resolution = resolution_string.split()[0]
width, height = resolution.split('x')

Whenever you need to pipe data with Python, you will need to create two different subprocess instances. That is what I did above. I piped the output from xrandr to my second subprocess via its stdin. Then I closed the stdout of the first process to basically flush whatever it had returned to the second process. The rest of the code just parses out the width and height of the monitor.


This week we would like to welcome Lacey Williams Henschel (@laceynwilliams) as our PyDev of the Week. She is very active with the Django Girls organization. Let’s spend some time getting to know her better!



I am launching a back-to-school sale of my Python 101 course. You can get the Python 101 book now for 50% by using the following offer code: fall2015. This offer is good until September 15, 2015.

You can also get my Python 101 Screencast for 50% off (i.e. $25 no offer code required). It includes the book, but it should be noted that it won’t be completed until December 2015. There are 15 videos completed at this time. The first 11 are available free of charge on Youtube, so you can try before you buy.

This week we welcome Ram Rachum as our PyDev of the Week. Ram is the author of the Python Toolbox and PythonTurtle. Let’s spend some time getting to know him better!



This week we welcome Patrick Maupin as our PyDev of the Week. Let’s spend some time getting to know Patrick a bit better.

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

I was born in San Antonio, Texas and raised in Austin. I spent several months working in England, and met and married a wonderful English lady and brought her home. We’ve lived in Austin for the last 30 years, except for one year we spent in Toronto. We have two great girls — one is in medical school, and the other is a budding composer/author.

I rotate through a few hobbies — bicycling, sailing, playing tuba in a community band. The tuba is actually something I re-started just a few years ago. I wound up dropping out of school when my lung collapsed when I was playing tuba with the UT Longhorn Band. Fortunately, my lung was repaired later…

I had been pursuing a degree in electrical engineering, because playing with electrons was my passion ever since I can remember. When I dropped out of school, I couldn’t find a job doing electrical stuff, but I did find one programming, and then worked myself into positions where I was doing both hardware and software. I have mostly worked near the hardware — drivers, embedded stuff, modem firmware, or on the hardware — board design, Verilog blocks for chips, etc., or on tools that help to use and test the hardware — schematic checkers, JTAG programmers, etc.

For the last 20 years, I’ve only worked for chip companies, and helping to design chips suits me, because successful chip companies are committed to practices that lead to working products — a failed tapeout can cost hundreds of thousands, or even millions of dollars, plus the lost opportunity costs of waiting one to three months for your first chips to come back so you can even test them. A product that fails in the field on a customer board can be unimaginably costly, as well, so chip manufacturers usually don’t just give lip-service to words like “testing” and “quality.”

I’ve worked at the same place for the last nine years, but we’ve been acquired a couple of times. The name on the door now says Microsemi, and it’s a great place to work.

I’ve sort of worked myself into a position where the hardware guys think I’m a software guy, and the software guys think I’m a hardware guy. That probably means I don’t do either one very well.


I meant to post this earlier, but I’ve been experiencing some issues with my laptop. Anyway, here’s the last free video from my Python 101 Screencast series. In this episode, you will learn the basics of using classes in Python 3. I hope you enjoy it!

This week we welcome Aaron Maxwell as our PyDev of the Week! Aaron is the author of the Advanced Python Newsletter and a very enthusiastic Pythonista. You can check out his github profile to get an idea of what he’s been up to. Let’s spend some time getting to know him better.