Python


This is the last article of my “Build a Binary Series”. If you haven’t done so already, be sure to check out the others. For our finale, we are to look at Andrea Gavana’s wxPython-based GUI2Exe, a nice graphical user interface to py2exe, bbfreeze, cx_Freeze, PyInstaller and py2app. The latest release of GUI2Exe is 0.5.0, although the source may be slightly newer. Feel free to run from the tip as well. We’ll be using the example scripts that we used for several of the previous articles: one console and one GUI script, neither of which do much of anything. (more…)

Python 3 Object Oriented Programming

By Dusty Phillips

Amazon

Packt

(more…)

The bbfreeze package also allows us to create binaries, but only on Linux and Windows. It’s just an easy_install away, so if you plan on following along with the examples in the article, you should go get it. The bbfreeze package includes egg support, so it can include egg dependencies in your binary, unlike py2exe. You can also freeze multiple scripts at once, include the Python interpreter and more. According to bbfreeze’s PyPI entry, it’s only been tested with Python 2.4-2.5, so keep that in mind. However, I was able to use it with Python 2.6 with no obvious problems. (more…)

Pragmatic Python Cover  Image

Practical Programming: An Introduction to Computer Science Using Python

By Jennifer Campbell, Paul Gries, Jason Montojo and Greg Wilson

Amazon

I received the book, Practical Programming: An Introduction to Computer Science Using Python as a gift last month from a family member. This book is by four authors: Jennifer Campbell, Paul Gries, Jason Montojo and Greg Wilson. I’d been interested in reading another Python-related textbook for a while, and this happens to be one of the few out there. The only other Python textbook I’ve read is Python Programming: An Introduction to Computer Science by John Zelle. I’m aware of one or two others, but those books are beyond what I’m willing to pay. (more…)

In this article, we will be learning about cx_Freeze, a cross-platform set of scripts designed to “freeze” Python scripts into executables in a manner similar to py2exe, PyInstaller, etc. We will freeze one console script and one window (i.e GUI) script, using the examples from the previous article in this series. If you haven’t done so already, you can get cx_Freeze here. Let’s get this party started, shall we? (more…)

In our previous article on building binaries, we learned a little about py2exe. This time around, we will be focusing our collective attention on the ins and outs of PyInstaller. We’ll use the same lame wxPython script from the last article for one of our examples, but we’ll also try a normal console script to see what the differences are, if any. In case you didn’t know, PyInstaller works on Linux, Windows and Mac (experimental) and works with Python 1.5-2.6 (except on Windows, where there’s a caveat for 2.6 – see below). PyInstaller supports code-signing (Windows), eggs, hidden imports, single executable, single directory, and lots more! (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…)

Next Page »