Forums Forums Forums

April 8th, 2010

I just wanted to re-point out the fact that there are some forums associated with this blog. There’s not much happening there, and recently they have become a haven for spammers, but I’m trying to clean them up and if other Python programmers read this blog maybe the forums could actually become useful!

Either way for those that didn’t know, there are learning python forums available.


AVC: Simplifying your GUI Code

March 14th, 2010

Note: This article was first published the April 2008 issue of Python Magazine

By: Mark Mruss

GUI programming, like many other types of programming, can sometimes prove exhausting because you must repeat yourself over and over again. AVC is one tool available to Python GUI programmers that attempts to simplify things by synchronizing application data and GUI widgets.

Introduction

Every once in a while I find myself browsing the Internet trying to find out what’s new and exciting in the Python world. Sometimes I browse to find topics for this article; other times mere curiosity draws me across the web. While I was browsing the other day, I stumbled across AVC: the Application View Controller [1]. I was immediately intrigued by it because its’ name is so similar to the Model View Controller (MVC) pattern. Being familiar with the Model View Controller pattern, and admittedly having struggles with it in the past, I decided to check out AVC to determine if it might be a viable alternative.

After reading about AVC I was intrigued for several reasons. The main reason was the promise of “a multiplatform, fully automatic, live connection among graphical interface widgets and application variables.” [2] This means that graphical widgets can be connected to variables and automatically synchronized. One of the (many?) problems with Graphical User Interface (GUI) programming is that you often find yourself doing the same thing over and over again. One of the things that you end of doing over and over again is setting the contents of a widget based on the value of a variable, and then subsequently, setting that variable’s value based on the current state of the widget. Whenever someone promises me an automatic connection between GUI widgets and my variables, I’m interested.

Read the rest of this entry »


Poll: Python Version

March 4th, 2010

Edit: Due to popular demand (well a couple of comments) I’ve decided to allow multiple answers to the poll. This should make everyone that uses two versions happy.

With two major versions of Python available to us Python programmers (2.X and 3.X) I thought it would be interesting to see which version the readers of this blog are using and targeting.

Personally I’m still using 2.5 on my Debian box because it’s the default, and 2.6 on my Windows PC. While I have used 3.X and have it installed, I’ve remained on the 2.X branch largely because many of the modules that I play around with are still focused on the 2.X branch so that’s where my focus has remained.

I voted 2.5 since I do that majority of my programing on my Debian box. So now what about you:

Which version of Python do you use?

  • 2.6 (65%, 700 Votes)
  • 3.1 (17%, 187 Votes)
  • 2.5 (17%, 182 Votes)
  • 2.7 (4%, 48 Votes)
  • 2.4 (3%, 32 Votes)
  • 3.0 (2%, 20 Votes)
  • 2.3 (0%, 5 Votes)
  • 2.1 (0%, 3 Votes)
  • 1.5 (0%, 2 Votes)
  • 2.2 (0%, 1 Votes)
  • 2.0 (0%, 1 Votes)
  • 1.6 (0%, 1 Votes)

Total Voters: 1,084

Loading ... Loading ...

If you want to explain your choice leave a comment below.

An Introduction to Google Calendars

February 27th, 2010

Note: This article was first published the March 2008 issue of Python Magazine

Mark Mruss

Over the past few years Google has expanded it’s services beyond those of a normal search engine. One of those new services is the Google Calendar. This article will provide an introduction to working with the Google Calendar using Python.

Introduction

As many of you know, Google has branched out and started offering more services besides their ubiquitous search engine. You have email, calendars, documents, spreadsheets, photos, maps, videos, source code hosting, and the list goes on. Fortunately for us Python programmers, Google released the Google data Python Client Library on March 26th, 2007, giving Python programmers easy access to some of these services.

Read the rest of this entry »

Introducing Docstrings

January 8th, 2010

By: Mark Mruss

Note: This article was first published the February 2008 issue of Python Magazine

Of all the tasks assigned to programmers, commenting code and writing documentation are among the most disliked. This article introduces you to Python’s documentation strings. While they won’t make commenting your code any more enjoyable, they will provide a systematic approach to doing it, as well as access to additional tools for documentation generation and testing.

Read the rest of this entry »

Iterators, Iterables, and Generators! Oh, my!

February 23rd, 2009

By: Mark Mruss

Note: This article was first published the January 2008 issue of Python Magazine

Iterators, iterables, and generators are features handled so wall by Python that people programming in other languages cannot help but drool over. Fortunately for us, creating iterators, iterables and generators is a relatively simple task. This article introduces the concepts of iterators, iterables, and generators and illustrates how easy it is to add them to your code.

  1. Introduction
  2. Iteration in Python
  3. An Initial Example
  4. Creating An Iterator
  5. Looking More Closely At The Iterator
  6. The Upside And Downside Of Iterators
  7. Generators
  8. Looking Closely At The Generator
  9. But What About Iterables?
  10. Creating An Iterable Object
  11. Conclusion

Read the rest of this entry »

DodgerEditor 0.1a

November 14th, 2008

So just to prove that I’m a masochist and that the Dodger Editor is not dead (even though I don’t think that anyone has been using it) I thought I’d post a quick update. No the editor is not dead and no neither am I.

I’m still writing for Python Magazine and working on the editor in some of the free time that I get. I just added a selection cursor mode to the editor which makes it easier for me to use. You can see it in the second row of the pallet in the following screen shot.

Now with a Select Mode!

Now with a Select Mode!

If you want access to the newest code you can grab it from the mercurial repository: http://freehg.org/u/selsine/dodger/

If anyone is at all interested in this project, whether it’s using or helping to develop, or just some suggestions please let me know. I’m always open to opinions. If I get the time I’d like to work on a short post showing you how you can use the Dodger Editor to create the level files for a game, when that will be I don’t know but hopefully soon.

TextWidget 0.1

September 21st, 2008

It’s been a long time since I worked on TextWidget at all, but since someone posted a question about it I decided to fix the issue and re-release the source. But since I didn’t want to simply update the blog post I decided to give the project a proper home on google code: http://code.google.com/p/textwidget/

The project is really simple and meant as an easy way for you to create “text buttons” for your PyGame projects. It’s not meant to be the definitive way to do this, just a simple solution for people that just want to drop a class in and have working “text buttons”. It’s LGPL so you can use it in whatever way you want. If you do decide to use it please drop me an email and let me know.

For more information on how to use the project please take a look at the initial blog post.

An Introduction to PyQt: creating GUIs with Python’s QT bindings

September 20th, 2008

By: Mark Mruss

Note: This article was first published the December 2007 issue of Python Magazine

While the command line will never cease to be useful, nothing will impress your friends more than your latest python masterpiece wrapped up in a slick cross-platform Graphical User Interface (GUI). This tutorial will show you how to create a simple GUI in Python using PyQt4.

  1. Introduction
  2. Installing PyQt4
  3. Your First PyQt4 Application
  4. The Main Window
  5. Adding Some Widgets
  6. Signal Handling
  7. Displaying a Message
  8. Conclusion

Read the rest of this entry »

Dodger Editor 0.1

August 25th, 2008

So here it is the initial release of the Dodger Editor. You can download the source from the google code page. Originally I wanted to wait longer to release the first version, but as time went on and it kept taking longer and longer I realized that if I didn’t release the first version at some point in time I might never release it.

If I had gotten done everything that I wanted to get done then I would be releasing the full first version of the project instead of this incredibly alpha release. So if something doesn’t work don’t be surprised. That being said you should be able to use it for it’s basic functionality. Or at least that’s what I’m hoping.

Installation

Once you have met the requirements:

You should be able to install dodger by downloading the and extracting the source tarball. Once you have extracted the source change into the source directory and install using:


python setyup.py install

If you don’t want to install and just want to test dodger out simply follow the above instructions except instead of installing dodger run the following:


python runner.py

Contributing

I still want to setup a dedicated site that will host a mercurial repository of the code but for now I’m going to use the fabulous http://freehg.org site. For now if you want you can pull the source from  http://freehg.org/u/selsine/dodger/:


hg clone http://freehg.org/u/selsine/dodger/

For now any changes that you make or fixes will have to be emailed as a patch but eventually I want to make it much much easier for people to submit fixes.

If you are really interested in contributing to this project let me know via a comment to this post and or an email. Then once all of the source issue are setup we can start working together.

New Features

Since the last release there has been a lot of changes under the hood. The most visible changes for anyone using dodger is the addition of the zoom feature:

zoom example

zoomed out example

zoomed in example

zoomed in example

General Usage

For general usage information please read the README file or General Information page on the google site. It’s pretty rough right now but hopefully over time we’ll be able to work on it.

History

If you are interested in the history of this project you can read the following blog posts to see how everything came about:

Beware

If you do decide to use or test dodger remember that you are going to find a lot of bugs during the iteration. Please be kind and report the issue.