Tag Archives: Python

PyDev of the Week: Nina Zakharenko

This week we welcome Nina Zakharenko (@nnja) as our PyDev of the Week! Nina has been active in the Python community for several years and has spoken or keynoted dozens of conferences. She has also contributed to the Python core language! If you’d like to see what she is up to, check out her blog. Let’s spend a few moments getting to know Nina!

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

I’m embarrassed to admit it, but the mid-90s cyberpunk movie Hackers – about a group of hackers framed for deploying a world-threatening computer virus – inspired me to become a programmer at a very young age. Even more embarrassing – I owned a pair of rollerblades growing up. When I was 12, I learned HTML to make websites by reading and deconstructing the source code of sites I visited, and I slowly became more engrossed in technology. As an adult, I studied Computer Science in college, and since then I’ve held a variety of exciting jobs at companies like HBO writing software for satellite control computers, to working for companies like Meetup and at Reddit. This spring, I joined the incredible Cloud Developer Advocacy team at Microsoft as the first Advocate entirely devoted to Python. I love teaching and public speaking. In my spare time I like to snowboard, hike, travel, and tinker with microcontrollers and wearable electronics, such as these Python powered earrings. I tweet at @nnja and occasionally blog and post my talks at nnja.io. Continue reading PyDev of the Week: Nina Zakharenko

Creating GUI Applications with wxPython Kickstarter

I am pleased to announce my latest book project, Creating GUI Applications with wxPython which I am running a Kickstarter campaign for.

Creating GUI Applications with wxPython is a book that will teach you how to use wxPython to create applications by actually creating several mini-programs. I have found that while learning how the various widgets work in wxPython is valuable, it is even better to learn by creating a simple application that does something useful.

The code in this book will be targeted for Python 3 only using wxPython 4.

Creating GUI Applications with wxPython cover

For more information, please check out the Kickstarter.

PyDev of the Week: Lance Bragstad

This week we welcome Lance Bragstad (@LanceBragstad) as our PyDev of the Week! Lance is a core developer of the OpenStack project. You can find out more about his passions via his website or his Github profile. Let’s spend some time getting to know Lance!

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

In 2012, I graduated with a degree in Computer Science from North Dakota State University, located in Fargo (yup, like the movie). Since then I’ve become more and more passionate about open-source software. I spend most of my time in the OpenStack ecosystem.

Besides being passionate about open-source software, I’m an avid outdoorsman. My wife and I train for running events together. I also donate time as a volunteer firefighter for our community of about 700 people. Continue reading PyDev of the Week: Lance Bragstad

PyDev of the Week: Kushal Das

This week we welcome Kushal Das (@kushaldas) as our PyDev of the Week! Kushal is a core developer of the Python programming language and a co-author of PEP 582. You can learn more about Kushal by checking out his blog or his Github profile. Let’s take a few moments to get to know Kushal better!

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

I am a staff member of Freedom of the Press Foundation. We are a non-profit that protects, defends, and empowers public-interest journalism in the 21st century. We work on encryption tools for journalists and whistleblowers, documentation of attacks on the press, training newsrooms on digital security practices, and advocating for the the public’s right to know.

I am also part of various Free Software projects through out my life. I am a core developer of CPython, and a director of the Python Software Foundation. I am part of the core team of the Tor project. I am a regular contributor to Fedora Project for over a decade now.

I co-ordinate https://dgplug.org along with a large group of friends and fellow contributors in various projects. We spend time together in learning new things and helping out each other on the #dgplug IRC channel on Freenode server. Feel free to visit the channel and say “Hi” to us.

I try to write about the things I learn regularly on my blog. Continue reading PyDev of the Week: Kushal Das

wxPython: Changing Custom Renderers for Columns / Rows

The wxPython GUI toolkit has a very rich and powerful Grid widget that I have written about previously on this blog. It allows you to create sheets of cells similar to those in Microsoft Excel.

There is also a neat mixin that allows you to apply a custom renderer to the labels on the columns and rows of the grid.

Let’s take a look at that and see how it works:

import wx
import wx.grid as grid
import wx.lib.mixins.gridlabelrenderer as glr
class MyGrid(grid.Grid, glr.GridWithLabelRenderersMixin):
    def __init__(self, *args, **kw):
        grid.Grid.__init__(self, *args, **kw)
class MyColLabelRenderer(glr.GridLabelRenderer):
    def __init__(self, bgcolor):
        self._bgcolor = bgcolor
    def Draw(self, grid, dc, rect, col):
        hAlign, vAlign = grid.GetColLabelAlignment()
        text = grid.GetColLabelValue(col)
        self.DrawBorder(grid, dc, rect)
        self.DrawText(grid, dc, rect, text, hAlign, vAlign)
class MyPanel(wx.Panel):
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        grid = MyGrid(self, size=(100, 100))
        grid.CreateGrid(numRows=10, numCols=10)
        for col in range(0, 10, 3):
                col+0, MyColLabelRenderer('#e0ffe0'))
                col+1, MyColLabelRenderer('#e0e0ff'))
                col+2, MyColLabelRenderer('#ffe0e0'))
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(grid, 1, wx.EXPAND)
class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, title='Custom Grid Renderers')
        panel = MyPanel(self)
if __name__ == '__main__':
    app = wx.App(False)
    frame = MyFrame()

Let’s break this down a bit. You will notice at the top of the code that we need to import the Grid widget separately in wxPython. We also need to import a mixin called GridWithLabelRenderersMixin. We subclass the Grid class and add in the mixin and then initialize both.

Next we create a subclass of GridLabelRenderer, which is also from the mixin. This allows us to create a spacing Draw method that will give us the ability to apply different colors or fonts to the labels in our Grid. In this case, I just made it so that we could change the color of the text in the labels.

The last piece of code that we are interested in is in the MyPanel class where we actually instantiate the Grid and change the color of the background of the labels in the columns. Here is what the grid ended up looking like:

wxPython Grid widget with colored columns
Custom Grid Column Renderers

Wrapping up

The wxPython toolkit has dozens of pre-built widgets that you can use to create cross-platform user interfaces. The wxPython demo has a much more involved example than this article does that you might also find interesting. If you haven’t given wxPython a try, you really should go get it. It is pip installable from PyPI and compatible with Python 3.

PyDev of the Week: Mike Grouchy

This week we welcome Mike Grouchy (@mgrouchy) as our PyDev of the Week. Mike co-founded PyCoder’s Weekly along with Mahdi Yusuf (@myusuf3). He is also the creator of Django Stronghold, a fun Django package you should check out. Let’s take a few moments to get to know Mike better!

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

I currently work as the VP of Engineering at a Startup called PageCloud I am also one of the co-founders/creators/curators of Pycoders Weekly a weekly Python newsletter. As for my background, I’m from St.Johns Newfoundland on the east coast of Canada. I got a BSc in computer science at Memorial University there and then moved to Ottawa, Ontario after that to work (a short stint working in the Canadian government and startups since). In my spare time I usually am busy with my two kids, but when they are sleeping and I’m not working I spend my free time working on some open source things Django Stronghold, new initiatives for Pycoder’s, and messing around with home automation stuff. I’m also starting to get interested in the home server building thing, especially on the budget build side of things. It’s cool to see all the great things you can do repurposing old server hardware that can be gotten inexpensively. Continue reading PyDev of the Week: Mike Grouchy