Python


Most people don’t really think about the widgets they use every day. Instead, they just take them for granted. The button is one of the most commonly used widgets that we use. From the keys on our keyboards to the buttons on door locks, we find them everywhere. They are even more prevalent in software where buttons can be practically any shape or size. Some buttons don’t even look like buttons! In this article, we’ll look at several buttons that wxPython provides for you and how to use them. (more…)

Last year I needed to figure out a way to get the following information with Python: get the route table, capture the data from pinging a series of IPs, run tracert and get information about the NIC(s) installed. This all needed to be done on a Windows machine as it was part of a diagnostics script to try to figure out why the machine (usually a laptop) wouldn’t connect to our VPN. I ended up creating a wxPython GUI to make it easy for the user to run, but these scripts will work just fine without wx. Let’s see what they look like! (more…)

Earlier this week, I was reading my copy of “Hello World” by Warren D. Sande and Carter Sande and in its chapter on graphical user interfaces, it mentioned a library called EasyGui. It’s the first and only Python GUI project I’ve seen that’s not event-driven. Instead, EasyGui is basically a set of dialogs that can be opened on demand. This package would be handy for command line programs that need to get information from the user using a dialog or for teaching new programmers about simple GUIs. Let’s take a quick look at what EasyGui can do. We’ll use some of the examples from the book. (more…)

If you use GUIs in Python much, then you know that sometimes you need to execute some long running process every now and then. Of course, if you do that as you would with a command line program, then you’ll be in for a surprise. In most cases, you’ll end up blocking your GUI’s event loop and the user will see your program freeze. What can you do to get around just mishaps? Start the task in another thread or process of course! In this article, we’ll look at how to do this with wxPython and Python’s threading module. (more…)

In late December, I was approached by Packt Publishing to write a book on wxPython. I turned them down because the editor’s vision for the book and mine did not mesh. Anyway, I did end up accepting the job of being a technical editor for one of their upcoming books: Python 3 Object Oriented Programming by Dusty Phillips. I started doing that in January 2010. The “pay” is a copy of the book plus one other book of my choice from Packt’s catalog. That’s it. I won’t get either book until this one is published, which is supposed to happen in August of this year. This article is a preview of the book. (more…)

There’s a handy 3rd party module called pyPdf out there that you can use to merge PDFs documents together, rotate pages, split and crop pages, and decrypt/encrypt PDF documents. In this article, we’ll take a look at a few of these functions and then create a simple GUI with wxPython that will allow us to merge a couple of PDFs. (more…)

Where I work, we run a number of login scripts written in Python. When an error occurs in one of those scripts, we want to know. So we wrote a simple Python script to email the error to us. Since then, I’ve needed to figure out a way to send attachments with some of my more advanced scripts. If you’re a long-time reader of this blog, then you may remember wxPyMail, which was a simple wxPython program that could send email. In this article, you’ll discover how to send email with just Python’s standard library. We will focus on smtplib and the email modules. (more…)

Have you ever wondered if you could create a wxPython program using XML? Well, I never did either, but there is a way and its name is XRC. In fact, wxPython comes with an editor called XRCed that you can use to layout your GUI and generate the XML code with. In this article, we’ll give you a quick walk-through of XRC and how to use it to create a couple GUI skeletons. We will look at two examples that use only XRC controls and then a third that mixes in some additional non-XRC widgets. (more…)

The other day, I received a request to create a script that could tell how long a Windows XP machine had been idle and to alert the user if it had been idle for a certain amount of time. I did a little research with Google and found a couple of ways to accomplish this feat. The only one I was able to get working was a ctypes example, so without further ado, let’s check it out! (more…)

While working on my Python mp3 player I realized I needed to research what Python had to offer for parsing ID3 tags. There are tons of projects out there, but most of them appear to be either dead, don’t have documentation or both. In this post, you will discover the wild world of MP3 tag parsing in Python along with me and we’ll see if we can find something that I can use to enhance my mp3 player project. (more…)

« Previous PageNext Page »