Archive for May, 2008

As planned, I copied some of my tutorials to the official wxPython wiki. Currently I only have the sizer tutorials over there.

I am working on a series that will show how to build a simple application from the ground up. Hopefully I can take the bits and pieces of it and make it easy to follow. If so, I’ll post the bits and pieces to the wiki too, after I get some feedback so I can shine them up a bit.

You should be seeing the first post of that series soon. Hopefully by the weekend.

I received a question about how to put an image in my frame’s toolbar on Windows. As it is, the toolbar just uses a generic icon. There are three ways that I am aware of. The first is to get an embedded image out of an executable. The second is to take some image you have and just embed it. The last way is to take your image and turn it into a Python file that can be imported. I’m sure you could also mess with PIL or maybe even use the paint handler, but I don’t know that stuff.

(more…)

In this tutorial, I will take my code from the GridSizer tutorial I wrote the other day and heavily modify it to display oddly shaped widgets in a GridBagSizer. The GridBagSizer is the most complex of the sizers. It subclasses the FlexGridSizer, so you can use all of it’s parent’s methods as well as those that the GridBagSizer adds. See the docs or use Python’s help() functionality for more information on said methods.

(more…)

In my last post, I wrote how to use a GridSizer to create a generic form. Unfortunately, the wx.TextCtrls all ended up looking fat. It seems that passing a wx.EXPAND flag to the GridSizer when adding the TextCtrl causes it to expand to fill the cell as well as resize when the window itself is resized.

(more…)

In my last post, I created a generic form in wxPython using only wx.BoxSizers for automatic sizing of my widgets. This time, I am adding on to my previous example using a wx.GridSizer to show the following:

  • How to right-align the icon and the label
  • How to vertically align the label with the text control
  • How to keep the text controls lined up no matter what the length of the labels are.

(more…)

I volunteered to write some tutorials on common GUI layouts in wxPython. The following example came from Malcolm, one of the members of the wxPython user’s group.

(more…)

The past couple of days, I’ve needed a way to create a shortcut on a user’s desktop during the login process. I had a way that worked for most shortcuts, but I just could not figure out how to do this one.

(more…)

One of the first scripts I had to help translate from Kixtart to Python was our map drives script. In it, we would map drives based on either which group the user was in and/or what a custom registry entry said. Here is a partial example of each of these categories in Kixtart:

IF READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\MyOrg", "Office")= "officeName"
$Drive="g:" $Path="\\serverName\" + @userid Call "@lserver\\folderName"
ENDIF
 
IF InGroup("Dept XYZ")
$Drive="g:" $Path="\\serverName\" + @userid Call "@lserver\\folderName"
ELSE
ENDIF

(more…)

I became a computer programmer in the real world two years ago. To mark this anniversary, I thought I’d talk about some of the things I learned during my time so far. But before we get to that, I think some background is in order.

My academic life included going to Iowa State University where I earned a B.S. degree in Management Information Systems. While there, they taught C++ and C# for the programming side of things, and Oracle/SQL for databases. After college, I got a job as a webmaster at an auction company. This wasn’t what I wanted, but it paid the bills. However, I quickly forgot much of what I had learned.

Thus, when I was in negotiations for my employment, they mentioned that I would have to learn Python, something I had never heard of. I bought a Python book entitled “Python Programming for the Absolute Beginner” by Michael Dawson. While I liked learning about game programming, the book is not well structured for someone trying to learn the basics of the language. However, it looked easy to pick up. And so it was.

Upon my employment, I was tasked with learning Python thoroughly on my own in about 2-3 weeks. Then I was supposed to take all the login scripts and translate them from Kixstart (another language I’d never heard of) to Python. We also use Zope and Plone for the company website and my boss wants me to learn that too. I still don’t get Zope or Plone, but I am beginning to understand them better and I can hack together very basic pages with it.

Next time I’ll give examples of some of the scripts that needed translating and their Python equivalents (or what I thought was equivalent anyway).