I must say, this has been a great experience trying out some graphical programming in Python. I looked at two different graphics packages for this exercise, Tk and PyGame. While Tk is very good for many graphical interfaces, particularly GUI, it did not provide what I needed most – the ability to do pixel by pixel plotting. Tk, does provide a “way” of doing it using the PhotoImage class, but it was rather cumbersome and felt like a workaround. So, I explored PyGame. It is a mature third party Python library specifically designed for graphical game design. It had exactly what I needed and was very straight forward. I simply wanted to create a display screen area and plot colored pixels to it corresponding to Mandelbrot Set. PyGame gave me exactly what I needed. Here is a series of pictures of the Mandelbrot Set. First, the full set. Second, an image zooming in on a region in the set. Third, zooming in even further. The fascinating thing about the Mandelbrot Set, and all fractal objects, is the the more you zoom in, the more detail you see – not less.
Now that I have got the basics down of using Python to do some tasks at work and some programming for my own enjoyment (i.e. the MazeGame). Now it is time to learn how to get graphics other than a GUI working for me. For this, I have decided to write a simple program to generate a Mandelbrot set fractal. This is one of the first major programs I ever wrote, way back in the late 1980s. Time to revisit it in Python. I am going to try out the Pygame library for the graphics on this program.
I am a BIG fan of the old adage that says “The best things in life are free.” Of course, one of the very best FREE things is the GNU/Linux operating system. However, to take full advantage of Linux, one should learn the Linux command line . Sure, there are enough books to buy out there on the subject of Linux to fill a library and spend a not so small fortune in the process. But why spend that money and fill bookshelves with books you will likely only skim through or outright never read when one of the very, very best books on the subject is 100% free? I am referring to the book by William E. Shotts, Jr. – The Linux Command Line. This is by far the best book on the subject of the Linux command line and scripting that I have ever read. The truth is, it is one of the best books on this subject for Linux or Unix out there. While specifically targeted at the Linux operating system, much of it is applicable across the whole family of what is called Unix-like operating systems including Linux(in its many various distributions), the BSD Unix family(FreeBSD, NetBSD, OpenBSD, etc.), System V Unix systems including Solaris/OpenSolaris, HP-UX, and even Mac OS X. In truth, all of these operating systems share far more in common in their use of the command line and utilities than they differ, so The Linux Command Line is a great resource for them all. I highly recommend this book!
I have previously blogged concerning my excursion into learning the Python programming language. In this post, I show how it has all started coming together with the code for a program I wrote at work. The purpose of the program was to generate an email with information about an Engineering Change Notice. It features examples of using the cx_Oracle module for accessing an Oracle database, the win32com module from Pywin32 for creating an email in MS Outlook, and Python’s native tkinter module for creating a simple GUI interface. There are lots of goodies here in a relatively short program. Enjoy!
My Engineering Change Notice Program: http://wa5pb.sdf.org/ECNdist_Tkv4-x.py
On a side note, my buddy K5WLF is also learning Python and writing a program in the process. He has described the program as a calculator for Amateur Radio Operators to handle some of the computations we commonly perform. http://www.rebelwolf.com/blog/?p=274