During the summer, I stumbled upon an article on Ars Technica about using PyGTK to create a URL shortener. I thought that was pretty interesting, but I don’t use PyGTK. So at that point, I decided to write my own using wxPython and use the article’s code to do the shortening. I hacked together something pretty quickly and then put this article on the back burner and kind of forgot about it. Today, I decided to go ahead and finish it and also create an application that can shorten URLs using other popular URL shorteners. Continue reading Shortening URLS with wxPython
The wxPython ListCtrl is a very handy widget. Unfortunately, it can be a pain to use as well. This discovery caused Phillip Piper, missionary to Mozambique, to write ObjectListView, a wrapper for the wx.ListCtrl. ObjectListView actually adds functionality because it uses objects to create its rows and thus, it makes gettings information from multiple columns much easier. Mr. Piper also added lots of other conveniences that makes adding custom editors easier, alternating the color of rows, automatically sorts rows, and much, much more! This article will help you learn some of the basics of using ObjectListView so that you’ll be able to use it in your future projects. This is not meant to be an exhaustive look at the control as it is actually very well documented. Continue reading wxPython: Using ObjectListView instead of a ListCtrl
In the first part of this series, I wrote on all the non-agw notebook widgets included with wxPython. For this second article, I will be focusing on the two notebooks that are in the AGW library of wxPython. AGW stands for Advanced Generic Widgets, a set of widgets that are written in Python instead of wrapped C++ code. I personally think that AGW is also a callback to its amazing author, Andrea Gavana. Regardless, the two widgets in this review will be the FlatNotebook and another AUI Notebook. The FlatNotebook has a great demo and I will spend most of this article on demos I’ve created that are based on it. The AUI Notebook is a part of agw.aui. While the demo for agw.aui is cool, it focuses on AUI in general, not the notebook. So I’ll just show you what I can glean from that. Now, let’s get cracking!
Update: The API changed slightly when it comes to AGW-related widgets. Basically some style flags in wxPython 18.104.22.168+ now require the agw-specific style flags. To use them, you’ll need to use the agwStyle keyword. See Andrea’s docs for more info: http://xoomer.virgilio.it/infinity77/AGW_Docs/ If you run into an error, try changing that first or post to the mailing list.
If you’re new to GUI programming (and wxPython in particular), you may not know what a “book” control is. It may be that other languages call this control something different too. In wxPython, a book control allows the user to switch between various panels. The most common examples are browsers and system option dialogs with tabbed interfaces. This article will walk you though the creation and basic configuration of these controls. Continue reading The “Book” Controls of wxPython (Part 1 of 2)
There is a lot of bad code in the world. My objective in this article is to help wxPython programmers learn how to make their applications easier to maintain and modify. It should be noted that what is in this article is not necessarily the so-called “best” way to refactor a program; instead the following is a representation of what I have learned from my own experience, with a bit of help from Robin Dunn’s book, wxPython in Action, and the wxPython community. Continue reading wxPython: Refactoring Your Program
We had out October Pyowa meeting last night and I thought it was very interesting. We had an executive from a local technology company called Priority5 come out and he told us how he got started with Python and how they use it at his current employer’s. We also had a talk on Optparse, ConfigParser and ConfigObj. Continue reading Pyowa – October 2009 Meeting Wrap-up
The last couple weeks, I’ve seen multiple people ask about resetting the color of a widget back to its original “default” color. There was at least one guy on the wxPython mailing list and another on their IRC channel that requested info on this topic. When I first looked up this issue, it was for the fellow programmer on the list who wanted to reset the background color of a panel. In my searching, I thought I had found the perfect solution: Continue reading wxPython: Resetting the Background Color
In this post, I’ll detail how to catch specific key presses and why this can be useful. This is another in my series of “requested” tutorials. There really isn’t much to catching key presses, but it can be a little confusing when one widget behaves slightly differently from another. The really complicated stuff comes in when you need to capture the EVT_CHAR. Continue reading wxPython: Catching Key and Char Events
This past couple of weeks, I’ve seen multiple people ask about timers and how they work either on the wxPython mailing list or on their IRC channel. So I decided it was high time I wrote a couple of example scripts to show how they’re used. I will cover two examples, the first of which will only have one timer and the second will have two. Robin Dunn contacted me with some improvements to the examples, so I have added a refactored example of each to this article. Continue reading wxPython: Using wx.Timers