The other day, there was a post on one of the mailing lists that I follow about accessing the Windows Event Logs. I thought that was an interesting topic, so I went looking for examples and found a pretty nice example on ActiveState. In this article, you’ll find out what I discovered. (more…)

A few months ago, I wrote about creating a simple MP3 Player using wxPython’s MediaCtrl widget. Since then, a fellow released the MplayerCtrl, a wxPython widget that wraps mplayer, a popular cross-platform media player. I actually ended up switching my MP3 Player’s backend to use this new control, but that’s a story for another post. This article will just focus on creating a really simple Media Player that you can play movies with. And you can do it all with Python! If you’re like me, you’ll think this rocks! (more…)

When I first started learning Python, one of the most confusing concepts to get my head around was the lambda statement. I’m sure other new programmers get confused by it as well and some of you are probably wondering what I’m talking about. So, in the spirit of education, let’s have a pop quiz:

Q. What is a lambda?

A. the 11th letter of the Greek alphabet
B. the craniometric point at the junction of the sagittal and lamboid sutures of the skull
C. the driver in an Arm Slave mecha that allows it to change the user’s thoughts into reality
D. the name of a series of Japanese rocket
E. anonymous (unbound) functions

If you guessed, F – all of the above, you got it right! Of course, in the context of this article, “E” is really the right answer. The Python lambda statement is an anonymous or unbound function and a pretty limited function at that. Let’s take a look at a few typical examples and see if we can find a use case for it. (more…)

Most typical users have used Microsoft Office. While Office may be the bane of tech support, we still have to deal with it. Python can be used to script (AKA automate) Office and make it easier for us or our users to use. It may not be as easy as recording a macro, but it’s close. For this article, you will learn how to use the PyWin32 module to access some of the Office programs and manipulate them with Python. Some forums say that you need to run PythonWin’s makepy utility on Microsoft Word (and Excel) before you can access Office applications. I don’t think I needed to do that to make it work though (at least, not with the 2007 version). However, PythonWin comes with the PyWin32, so if you do run into trouble, you can try it. (more…)

For the second half of this series, I discovered that there are even more dialogs than I originally thought. While it would have probably been a good idea to have split this into three parts, we’re going to stick with just two. In this article, we’re going to cover the following dialogs:

  • GenericMessageDialog (AGW)
  • ImageDialog
  • wx.MultiChoiceDialog
  • wx.PageSetupDialog
  • wx.PrintDialog
  • wx.ProgressDialog
  • PyBusyInfo (AGW)
  • PyProgress (AGW)
  • ScrolledMessageDialog
  • wx.SingleChoiceDialog
  • wx.TextEntryDialog

For the uninitiated, there’s also an AboutBox dialog that’s not here for the very simple reason that it’s already been covered in this blog outside of this series. Check that out for yourself. Just to clear up any confusion about why wx.Dialog isn’t here: this series ONLY covers pre-built dialogs. The wx.Dialog widget is great for creating your own custom dialogs. The last note that should be covered is that the example code here has been yanked from the wxPython demo and re-purposed for this article. (more…)

On Thursday, July 1st, we had our July Pyowa meeting. It was hosted by Matt Morrison at the IMT Group’s building in Des Moines, IA. We had our largest attendance ever with a total of 15 men showing up. Tavern Pizza and pop were served, which was also a first…we’ve had pop before, just not any food!

We had two presentations. The first was an around 70 minutes in length and covered introductory materials about Django, a full-stack web framework written in Python. It was given by our host and he also included anecdotes about how his company uses Django and what challenges that has presented him. Next up we had a quick talk about TurboGears, another web framework. TurboGears is actually a collection of various Python modules that have been pieced together, which makes it much more modular than Django. However, Django has a lot more users behind it and there are some definite advantages to having everything builtin. Anyway, the TurboGears presentation covered a group of different web sites (or web applications) that the presenter had created. It was interesting to compare and contrast the two frameworks and see how they differed or stayed the same.

We are currently looking for presenters for our August and September meetings, so if you want to talk about how you’re using Python now, in the past or even what you plan to do with it in the future, let me know by emailing me or in the comments!

I see a number of questions on the wxPython mailing list or its IRC channel about communicating between frames and most of the time what the developer needs is the PubSub module. The Publisher / Subscriber model is a way to send messages to one or more listeners. You can read about it here. The Observer pattern is said to be based on the Publish / Subscribe pattern. In wxPython land, we have the pubsub module which can be accessed from wx.lib.pubsub. It’s actually included in wxPython, but you can also download it as a standalone module from its Source Forge. An alternative to pubsub is the PyDispatcher module.

Anyway, in this article we won’t be studying the theory behind either of these modules. Instead, we’ll use a semi-practical example in wxPython to show how to use the built-in version of pubsub to communicate between two frames. If you’re still with me at this point, then I encourage you to read on! (more…)

Dialogs are an integral part of user interface design. We use them all the time. We find dialogs everywhere, in many shapes and sizes. In this article we will cover the following dialog types:

  • wx.BusyInfo
  • wx.ColourDialog
  • CubeColourDialog (AGW)
  • wx.DirDialog and MultiDirDialog (AGW)
  • wx.FileDialog
  • wx.FontDialog
  • wx.MessageDialog

That’s a lot of dialogs, but there’s still eight more in the wxPython demo. We’ll look at those next time. For now, let’s take a look at this list! (more…)

Every couple of months, I’ll see someone asking how to switch between two views or panels in a wxPython application that they’re working on. Since this is such a common question and because I had it asked last week on the wxPython channel on IRC, I wrote up a quick script that shows how it’s done. Note that in most cases, the user will probably find one of the many notebook widgets to be more than sufficient for their needs. Anyway, let’s take a look at how to do this thing! (more…)

In the last article, we covered a wide variety of buttons that come with the standard wxPython package. Now we’re going to look at a whole bunch more! In case you haven’t figured it out yet, wxPython takes Python’s “batteries included” philosophy very seriously! In this post we’ll look at the following buttons:

  • wx.RadioButton
  • wx.SpinButton
  • AquaButton (AGW)
  • GradientButton (AGW)
  • ShapedButton (AGW)

Let’s get cracking! (more…)

Next Page »