Cross-Platform


Background
================

This is the first release of a real project that I’ve been involved in. I had written an article last month that inspired Werner Bruhin to want to take it and make it into a demonstration program for new wxPython programmers in how to do MVC and CRUD while interfacing with a database. Thus, MediaLocker was born. We hope you like it.

Description
================

A wxPython database application that can help you keep track of your media. Currently, it only tracks your Book library. You can read more about the project’s development in the following two articles:

Requirements
================

- Python 2.6+
- wxPython 2.8.11+ with the new pubsub (download here) or wxPython 2.9.3
- SQLAlchemy 0.7.3+
- ObjectListView 1.2

Configuration
================

After you have downloaded the source, run “python setup_lib.py develop” in the main folder before you try to run “mediaLocker.py”. If you are on wxPython 2.8, download the pubsub path (above) and extract it to “C:\Python27\Lib\site-packages\wx-2.9.2-msw\wx\lib” (or wherever your wxPython is installed).

Source
================

You can download the source from BitBucket: https://bitbucket.org/driscollis/medialocker

You can also just download a snapshot of the current files here (uploaded 2011.12.09 @ 1138 hrs CST):

How you can help
================

Download the software and report bugs on BitBucket. We also happily accept feature requests, especially if they include patches or code.

Note: This has only been tested on Windows XP and 7

TurboGears is one of several web frameworks for Python that are available. The most popular by far is Django. Where I work, we chose TurboGears because of its integration with SQLAlchemy which supports composite keys. At that time, Django did not support that feature and I am not sure if it does yet. Anyway, I develop almost exclusively on a Windows box and have found the TurboGears’ documentation on the subject a little confusing. So here’s how I do it.

Note: We’ll be using TurboGears 2.1 in this tutorial (more…)

There was a recent post on StackOverflow that I thought was interesting. It asked how to get the event name from the event object, such as EVT_BUTTON, rather than the event’s id number. So I did some investigation into the subject and there is nothing builtin to wxPython that does this task. Robin Dunn, creator of wxPython, recommended that I should create a dictionary of the events and their ids to accomplish this feat. So in this tutorial, we’ll take a look at how to go about that. (more…)

Have you ever wondered about how to change your font in wxPython? Well, now is your lucky day because that is exactly what this tutorial is going to cover. We will look at the following three items:

  • Built-in fonts of wxPython
  • The font dialog
  • The font enumerator demo from the wxPython demo

Fonts are an important part of your program and enhance your program’s readability. It’s always a good idea to make sure your fonts are the right size and place. Yes, that’s common sense, but sometimes common sense doesn’t happen in programming. Enough philosophizing. Let’s get to the meat of the article!

(more…)

I attended the Creating GUI Applications in Python using Qt I by Paul Kippes this morning and then I attended half of his second tutorial on PyQt this afternoon. The speaker had lots of materials to give us including fairly extensive examples. I think I learned a lot during the morning session because I had a fair amount of hands-on code editing and using Qt’s Designer, which is a WYSIWYG editor for creating the GUI, kind of like Microsoft’s Visual Studio.

The second session was just a talk with no on-hands coding of any kind. I was not engaged during this tutorial very well and decided I would be better off leaving at break and doing something else. I’ll study the speaker’s notes and code examples later. Look forward to some articles on PyQt and perhaps PySide in the future!

Python code testing is something new to me. It’s not required where I work, so I haven’t spent much time looking into it, besides reading a book on the subject and reading a few blogs. However, I decided it was high time I check this out and see what all the excitement is about. In this article, you will learn about Test Driven Development (TDD) with Python using Python’s builtin unittest module. This is actually based on my one experience of TDD and pair programming (thanks Matt and Aaron!). In this article, we will be learning how to score bowling with Python! (more…)

The other day on the wxPython IRC channel on freenode, one of the members there asked if there was a way to make the wx.FileDialog display more than one file type at a time. In the back of mind, I thought I had seen a Microsoft product that could do it, but I’d never seen any wxPython examples. In this short tutorial, you will learn how to do this handy trick! (more…)

It’s time for your weekly dose of Python news. What happened in the last week? Or what did I find that I thought was newsy? Lots of stuff, it turns out. This week, you can learn about the controversy of PyPI, Tablib, a “fireside” chat with Python’s founder that’s coming up next month at PyCon USA and more.

I hope you find a few of those links useful or interesting. Feel free to give me a few for next week in the comments!

In this article, we will be looking at wxPython’s Wizard widget. No, it has nothing to do with Dumbledore or Gandalf. Instead, it is that dialog that you’ll see when you run an installer or set up a template. Sometimes you’ll even see them used for setting up mail merge. We will cover two examples in this tutorial: one that is fairly simple and another that is slightly more complex. Let’s get started!

Note: The code in this article was adapted from the wxPython Demo application

(more…)

PyChecker is a cool tool for checking Python scripts for bugs. It works with Python 2.0 – 2.7. In this article, we will write some crappy code to see what PyChecker can pick up on. Then we’ll improve the code according to what we find until the code checks out. According to PyChecker’s website, it can detect the following problems:

  • No global found (e.g., using a module without importing it)
  • Passing the wrong number of parameters to functions/methods/constructors
  • Passing the wrong number of parameters to builtin functions & methods
  • Using format strings that don’t match arguments
  • Using class methods and attributes that don’t exist
  • Changing signature when overriding a method
  • Redefining a function/class/method in the same scope
  • Using a variable before setting it
  • self is not the first parameter defined for a method
  • Unused globals and locals (module or variable)
  • Unused function/method arguments (can ignore self)
  • No doc strings in modules, classes, functions, and methods

(more…)

Next Page »