Archive for July, 2010

I received a request to create an article on how to use py2exe and wxPython to create an executable. I d, ecided to do a series on packaging instead. It is my intention to go over the major Windows binary building utilities and show you, dear reader, how to use them to create a binary that you can distribute. Once those articles are done, I’ll show how to use Inno and NSIS. To kick things off, we’ll go over how to use py2exe, probably the most popular of the Windows executable packages. (more…)

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!