Tag Archives: Python

PyDev of the Week: Scott Shawcroft

This week we welcome Scott Shawcroft (@tannewt) as our PyDev of the Week! Scott is the lead developer of CircuitPython, a variant of the Python programming language made for microcontrollers. If you’d like to see what else Scott is up to, his website is a good place to start. Let’s take a few moments to get to know Scott better!

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

I’m Scott, I graduated from the University of Washington in 2009 in Computer Engineering. Afterwards, I joined the Maps team at Google where I worked on rendering and styling of the map. I left in 2015 to do my own thing. I designed a modular flight controller system for racing quadcopters and learned about hardware at the same time. My hobbies include running, rock climbing, video gaming and thrift shopping for retro electronics (so I can put CircuitPython in them.) Continue reading PyDev of the Week: Scott Shawcroft

PyDev of the Week: Geir Arne Hjelle

This week we welcome Geir Arne Hjelle (@gahjelle) as our PyDev of the Week! Geir is a regular contributor to Real Python. You can also find some of his work over on Github. Let’s take a few moments to get to know Geir now!

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

Sure. I grew up in a beautiful village on an island in the north of Norway. My family has since moved south, but I still go north and visit friends and enjoy the nature regularly. I’ve always enjoyed playing with numbers, so I quite naturally ended up studying mathematics at the University. I did both a Master’s and a PhD at the Norwegian University of Science and Technology in Trondheim. During the PhD, I also got to spend about a year in my favorite big city: Barcelona. To this day, I spend a week or two in Barcelona every year.

After my studies, I lived three years in St. Louis, Missouri doing a Post.Doc at Washington University. Then I moved back to Norway, and I’m currently living in Oslo working with data science, mostly using Python.

I spend a fair bit of my free time with programming as well. I write tutorials for Real Python and helping teach kids how to code. I enjoy being outdoors. In Norway there are great opportunities for going skiing in the winter, and hiking in the summer. At this very moment, I’m actually basking in the sun in a hammock in the forest just outside of Oslo. Finally, I should note that I love getting together with friends for a board game session. Continue reading PyDev of the Week: Geir Arne Hjelle

Book Contest: Creating GUI Applications with wxPython

Last month, I released a new book entitled Creating GUI Applications with wxPython. In celebration of a successful launch, I have decided to do a little contest.

Cover art for Creating GUI Applications with wxPython

Rules

  • Tweet about the contest and include my handle: @driscollis
  • Send me a direct message on Twitter or via my contact form with a link to your Tweet
  • If you don’t have Twitter, feel free to message me through the website and I’ll enter you anyway

The contest will run starting now until Friday, June 21st @ 11:59 p.m. CST.

Runners up will receive a free copy of the eBook. The grand prize will be a signed paperback copy + the eBook version!

PyDev of the Week: Meredydd Luff

This week we welcome Meredydd Luff (@meredydd) as our PyDev of the Week! Meredydd is the co-founder of Anvil and a core developer for the Skulpt package. You can learn more about Meredydd on his website. Let’s take a few moments to get to know him better!

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

I’ve loved programming since I was first introduced to BASIC at the age of 7. I come from Cambridge (the old one in the UK, not the relatively-new one near Boston), and I studied here too. I actually started out as a biologist, but then switched to computer science for my PhD.

I think programming is the closest thing to magic we have, and I love watching and helping people get their hands on this power. My PhD research was about building usable parallel programming systems, and now I work on Anvil, a tool to make web programming faster and easier for everyone (with Python!).

When I’m not programming, I fly light aeroplanes, which I guess is what happens when your inner six-year-old makes your life decisions. I used to dance competitively (including a few years on England’s top Latin formation team), but it turns out international competitions and startups don’t play well together, so the startup won.
Continue reading PyDev of the Week: Meredydd Luff

PyDev of the Week: Valentin Haenel

This week we welcome Valentin Haenel (@esc___) as our PyDev of the Week! Valentin is a core developer of Numba and several other packages that you can see either on his website or on Github. He has also given several talks at various conferences in Europe. Let’s spend some time getting to know Valentin better!

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

I went to the University of Edinburgh to get a bachelor in computer science and to the Bernstein Center in Berlin to get a master in computational neuroscience. I tend to favour more traditional computer science topics these days such as compression algorithms and compilers. In my spare time, I spend time with my lovely wife Gloria, fly quad-line sports kites and ride longboards through Berlin. I’ve been doing Python and open-source on Github for about 10 years. Continue reading PyDev of the Week: Valentin Haenel

Book Review: Practical Python and OpenCV

I bought Practical Python and OpenCV a couple of years ago during one of its authors Kickstarters. I started reading it and then got busy with other things. The past couple of weeks, I decided to give the book another go and was able to finish it. Note that I started reading the 3rd edition of the book without realizing there was a 4th edition. After finished the 3rd edition, I compared it to the 4th side by side and it looks like they are nearly identical, so I don’t think it matters all that much.


Quick Review

  • Why I picked it up: Computer vision / machine learning sounds interesting to me and the author has a fun blog
  • Why I finished it: It’s short and the writing style is engaging
  • I’d give it to: Anyone looking to get started with OpenCV in Python

Continue reading Book Review: Practical Python and OpenCV

Getting the Correct Notebook Tab Across Platforms in wxPython

I was recently working on a GUI application that had a wx.Notebook in it. When the user changed tabs in the notebook, I wanted the application to do an update based on the newly shown (i.e. selected) tab. I quickly discovered that while it is easy to catch the tab change event, getting the right tab is not as obvious.

This article will walk you through my mistake and show you two solutions to the issue.

Here is an example of what I did originally:

# simple_note.py
 
import random
import wx
 
 
class TabPanel(wx.Panel):
 
    def __init__(self, parent, name):
        """"""
        super().__init__(parent=parent)
        self.name = name
 
        colors = ["red", "blue", "gray", "yellow", "green"]
        self.SetBackgroundColour(random.choice(colors))
 
        btn = wx.Button(self, label="Press Me")
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(btn, 0, wx.ALL, 10)
        self.SetSizer(sizer)
 
 
class DemoFrame(wx.Frame):
    """
    Frame that holds all other widgets
    """
 
 
    def __init__(self):
        """Constructor"""
        super().__init__(None, wx.ID_ANY,
                         "Notebook Tutorial",
                         size=(600,400)
                         )
        panel = wx.Panel(self)
 
        self.notebook = wx.Notebook(panel)
        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.on_tab_change)
        tabOne = TabPanel(self.notebook, name='Tab 1')
        self.notebook.AddPage(tabOne, "Tab 1")
 
        tabTwo = TabPanel(self.notebook, name='Tab 2')
        self.notebook.AddPage(tabTwo, "Tab 2")
 
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.notebook, 1, wx.ALL|wx.EXPAND, 5)
        panel.SetSizer(sizer)
        self.Layout()
 
        self.Show()
 
    def on_tab_change(self, event):
        # Works on Windows and Linux, but not Mac
        current_page = self.notebook.GetCurrentPage()
        print(current_page.name)
        event.Skip()
 
 
if __name__ == "__main__":
    app = wx.App(False)
    frame = DemoFrame()
    app.MainLoop()

Continue reading Getting the Correct Notebook Tab Across Platforms in wxPython

Sending email with EZGmail and Python

Have you ever wanted to send an email with GMail using the Python programming language? In 2018, Al Sweigart, best-selling author of Automate the Boring Stuff with Python, created a package called EZGmail. You can also use Google’s own bindings to do this sort of thing, but it’s a lot more complicated than using EZGmail.

In this article, we will take a quick look at how to use this package.


Setting Up

Your first step is to install EZGmail using pip. Here’s how:

pip install ezgmail

Then go to https://developers.google.com/gmail/api/quickstart/python and click the Enable the Gmail API button. This will allow you to download a credentials.json file and also give you a client ID and client secret. You can use the latter credentials with Google’s Python API client and you can manage these credentials here if you need to.

Now copy the credentials file to the location that you plan on writing your code. You will then need to run Python in your terminal in the same location that your downloaded credentials file is located.

The next step is to run ezgmail.init(). This will open up a web browser to Gmail where it will ask you to allow access to your application. If you grant access, EZGmail will download a tokens file so that it doesn’t need to have you reauthorize it every time you use it.

To verify everything is working correctly, you can run the following code:

>>> ezgmail.EMAIL_ADDRESS
'your_email_address@gmail.com'

This should cause your Gmail account name to print out. Continue reading Sending email with EZGmail and Python

PyDev of the Week: Stefan van der Walt

This week we welcome Stefan van der Walt (@stefanvdwalt) as our PyDev of the Week! Stefan is the creator of scikit-image, which is a collection of algorithms for image processing. You can see some of the projects that he is a part of on Github or on Berkeley’s website. Stefan also has his own website which is worth checking out. Let’s take a few moments to get to know Stefan better!

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

I am currently a researcher at the Berkeley Institute for Data Science (BIDS) at the University of California, Berkeley. I was born and raised in the university town of Stellenbosch, South Africa—renowned for its beautiful nature and world-class wines—where I studied electronic engineering, computer science, and applied mathematics. Growing up there, it was easy to fall in love with nature: I love running and hiking in the mountains, and exploring in general. Nowadays, most of my hobby time is spent with my two children, aged 1 and 3. Continue reading PyDev of the Week: Stefan van der Walt

PyDev of the Week: Sean McManus

This week we welcome Sean McManus (@musicandwords) as our PyDev of the Week! Sean is the author of several books, including Mission Python: Code a Space Adventure Game!, which was reviewed on this site in March. There are free chapters from his book available here. You can learn more about Sean on his website. Let’s take some time to get to know him better!

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

I’m a writer specialising in technology. In recent years I’ve written several books to get children and young adults into coding. The launch of the Raspberry Pi and initiatives such as Code Club have helped to make coding much more accessible to young people than it was for many years.

As a kid, I loved programming my Amstrad CPC computer and in many ways it started me on my career path. I had listings and articles published in the leading magazines of the day, and my first book was about Amstrad programming. Today, I can still remember how much I loved programming as a kid, and I hope that my books bring some of that excitement to today’s budding coders.

As well as writing books and articles, I help some of the world’s leading technology companies with their copywriting requirements.

Outside of writing, I enjoy photography and making music. I have recorded an album of electronic music I plan to release online later this year, and I am a member of a singing group which is a great way to unwind. Continue reading PyDev of the Week: Sean McManus