Posts Tagged ‘Python’

A Very Nerdy Birthday

Wednesday, February 24th, 2010

It was just a few days ago when Justin, our lead developer had a birthday. Us nerds in the dev department (aka… me) know just how to celebrate.

Write a python script that has ascii animation of a birthday dance!

Here’s a zip file with the python scripts in it. To run it on your computer, make sure that you have python installed, and extract the files into their own directory. If double clicking on justin.py doesn’t do anything (or it opens in notepad) then you can run it easily with the console window. Just browse to the same directory and type “python justin.py” and it should start to work. I can answer any issues in the comments.

If you are looking for some more nerdy fun, check out the ASCIImator (http://asciimator.net/). Here you can build your own ASCII animation, watch other people’s animations, or visit the ASCII zoo! My favorite is karaboz’s “walking old stickman.” What’s yours?


The Beauty of pyQT

Thursday, October 22nd, 2009

image_thumbHere at Zoom Creates we (the Dev Team) mostly deal with online applications. We build custom sites, implement CMS solutions, build animations, create databases, and much, much more. One thing that you might not have know is that we also build standard desktop applications. One of my favorite toolkits to use for Gui applications is the QT4 toolkit. Of course, my favorite language to build these apps in is python. Here’s a quick rundown of the latest app that I built in about 30 mins, to help remove one annoyance from my daily routine.

I connect to our in office server via sshfs. I also use this protocol when connecting to my webserver, and it gets a little old doing the same thing over and over again in the console. So, to solve this I built a little app that runs the sshfs command with some paramaters and is much quicker to get me connected to different servers. Here’s how I did it.

First run QTDesigner (the awesome GUI builder that Trolltech, the makers of QT, give away) and draw out your new program’s interface. Then save it. My file is named server.ui. Now, if you run pyuic4 on this file, you can send the output to a file. I did this by running this:
pyuic4 server.ui > server.py

So now I have an automatically generated file called server.py that has a class in it. This class has all the references to my GUI that I created in QTDesigner. Now, lets make a new python file that will import that file (server.py) and extend it so that we can give it some functionality. I called this new file mountStuff.py.

We want to extend server.py because if we ever need to make changes to our GUI, then all our code will be lost when we run pyuic4 on our updated .ui file. Check out the attached .zip file to see how this neat little program works.

mountStuff.zip


Code to Images

Thursday, October 1st, 2009

Look Ma! PIL Generated Images!My what a busy week! It’s been a pretty crazy couple of days here in the dev department. One neat thing about being super busy is that we usually get to learn something new to apply to the next project.

During the latest project I had the pleasure of generating images from code. As I do most of my coding in PHP, I immediately thought of GD as the right tool for the job, but as it turns out, we found something much better. Our servers don’t have PHP compiled with the ability to use true type fonts, and our lovely design team likes the fonts to look pretty (don’t we all?). So, since the pictures that I generated with GD looked so gross, I set off to find another good image generating library.

(more…)