PyDev of the Week: Adrian Rosebrock

This week we welcome Adrian Rosebrock (@PyImageSearch) as our PyDev of the Week. Adrian is the author of several books on Python and OpenCV. He is also the author of PyImageSearch.com, a very popular Python blog that focuses on computer vision. Let’s take some time to get to know him a bit better!

Can you tell us about yourself and PyImageSearch?

Hi Mike, thank you for the opportunity to be interviewed on PyDev of the Week.

My name is Adrian Rosebrock. I have Ph.D in computer science with a focus in computer vision and machine learning from the University of Maryland, Baltimore County (UMBC).

I blog over at PyImageSearch.com about Python, computer vision, and deep learning. Over the past few years running PyImageSearch I have written a handful of books/courses, including:

Continue reading PyDev of the Week: Adrian Rosebrock

wxPython: Moving items in ObjectListView

I was recently asked about how to implement drag-and-drop of items in a wx.ListCtrl or in ObjectListView. Unfortunately neither control has this built-in although I did find an article on the wxPython wiki that demonstrated one way to do drag-and-drop of the items in a ListCtrl.

However I did think that implementing some buttons to move items around in an ObjectListView widget should be fairly easy to implement. So that’s what this article will be focusing on.


Changing Item Order

If you don’t have wxPython and ObjectListView installed, then you will want to use pip to install them:

pip install wxPython objectlistview

Once that is done, open up your favorite text editor or IDE and enter the following code: Continue reading wxPython: Moving items in ObjectListView

Book Review: Python Testing with pytest

A couple of months ago, Brian Okken asked me if I would be interested in reading his book, Python Testing with pytest. I have been interested in learning more about the pytest package for a while, so I agreed to take a look. I also liked that the publisher was The Pragmatic Programmers, which I’ve had good experience with in the past. We will start with a quick review and then dive into the play-by-play.


Quick Review

  • Why I picked it up: The author of the book asked me to read his book
  • Why I finished it: I mostly skimmed the book to see how it was written and to check out the examples
  • I’d give it to: Anyone who is interested in testing in Python and especially in the pytest package

Continue reading Book Review: Python Testing with pytest

PyDev of the Week: Bruce Eckel

This week we welcome Bruce Eckel as our PyDev of the Week! Bruce is the author of several books including Thinking in Java, Thinking in C++ and Thinking in Python among others. He also has a Programming Blog that is well worth a look. Let’s spend some time getting to know Bruce better!

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

My dad was my first employer. He built custom homes and had me do drudge work around the construction site. His head carpenter told me that it was “so I didn’t want to go into construction.”

This was a very effective strategy. I went to multiple colleges for 8 years and ended up with a BS in Applied Physics and an MS in Computer Engineering. Mostly because the thought of getting a regular job sounded like prison.

I chafed at the imposed structure of industrial-age management, and my goal became to escape from that world, which I did a few years later, becoming an independent writer, trainer and consultant. I’ve done that ever since. About ten years ago I started to revisit the whole idea of working for companies and have written fairly extensively about it in ReinventingBusiness. Briefly, I think we are on the cusp of a new age in work, and I’m struggling to help bring that about.

I live in Crested Butte, Colorado, where I hold small conferences and other events. In the summer I mostly mountain bike, and in the winter I’ve recently switched from cross-country skiing to snow biking (I stopped downhill skiing after breaking my leg quite badly; I miss it but the risk/benefit just didn’t work anymore). I have played the lead in a number of theatre productions in our very small town, and I have been experimenting with abstract painting for a dozen years or so. Recently I’ve been helping out with a business accelerator project at the ICELab in our nearby town of Gunnison. I’ve visited a number of incubators and accelerators during my travels but this is the first time I’ve seen one from inside.

I’m also a bit of a workshop junkie. I’ve probably taken 50 workshops at Esalen by now, and others elsewhere. For me it’s a vacation — not only do you go to a different environment, but you have new things to keep your brain occupied so you don’t start thinking about what you are taking a vacation from.

For the last couple of years, as part of my study of Teal organizational structures, I have been working on a practice called Non-Violent Communication, taking three week-long workshops and reading numerous books. This has been one of the many eye-opening experiences in my Reinventing Business pursuits. Continue reading PyDev of the Week: Bruce Eckel

Python 3: Variable Annotations

Python added syntax for what something called Variable Annotation in the version 3.6. Variable Annotation is basically an enhancement of type hinting, which was introduced in Python 3.5. The full explanation behind Variable Annotation is explained in PEP 526. In this article, we will have a quick refresher on type hinting and then introduce the new Variable Annotation syntax.

What’s Type Hinting?

Type hinting in Python is basically declaring that the parameters in your functions and methods have a certain type. Python does not enforce the type “hints”, but you can use tools like mypy to enforce the type hints in much the same way that C++ enforces type declarations at run time. Let’s look at a normal function with no type hints added:

def add(a, b):
    return a + b
 
if __name__ == '__main__':
    add(2, 4)

Continue reading Python 3: Variable Annotations

Educative Python 101 / 201 Courses on Sale

It’s that time of year again where the holidays are upon us, so I am doing a sale of some of my works. You can get Python 101 for FREE and Python 201: Intermediate Python for 50% off. Here are the coupon codes you can use:

Note that Python 101 is completely FREE with this coupon while the second course is 50% off. You can also get Python 101’s eBook for free over on Leanpub. You can also get the eBook for Python 201 for 50% off by using this link: http://leanpub.com/python201/c/py201free

All these coupons are good for one week. Thanks for your support!

How to Add a Border to Your Photos with Python

Sometimes it’s fun to add a simple border to your photos. The Pillow package has a very easy method of adding such borders to your images via its ImageOps module. As usual, you will need to have Pillow installed to do any of the examples in this article. If you don’t have it already, you can install it with pip:

pip install Pillow

Now that we’ve taken care of that bit of housekeeping, let’s learn how to add a border!


Adding a Border

The focus of this article will be on using the ImageOps module to add our borders. For this example, we will use this photo of a neat butterfly I took. Let’s write some code! Continue reading How to Add a Border to Your Photos with Python

wxPython: Drag and Drop an Image onto Your Application

I recently came across a question on StackOverflow where the user wanted to know how to drag images onto their image control in wxPython and have the dragged image resize into a thumbnail. This piqued my interest and I decided to figure out how to do it.

I knew that you could create a thumbnail in Python using the Pillow package. So if you’d like to follow along you will need to install Pillow and wxPython with pip:

pip install Pillow wxPython

Now that we have the latest versions of the packages we need, we can write some code. Let’s take a look: Continue reading wxPython: Drag and Drop an Image onto Your Application