Rainbow Sprinkles

June 28th, 2010 by Sara Leave a reply »

In order to allow users to better interact with our program, we have begun development of a GUI. The creation of a simple user-friendly interface is especially important as we expect that many of our users may not be familiar with more technical interfaces, such as a Linux command line.

The GUI implementation began when we needed a way for users to easily create hemispheres, and other 3D shapes, in their objects. Using the Canvas widget from the Tkinter Python module, and its ability to easily create rectangle objects in specific positions, we were able to represent the sprinklized 2D image as a collection of squares, one per sprinkle.

To select an sprinkle, we implemented a mouse listener to pay attention to mouse clicks and keep track of which square the mouse was over. We then used an attribute of the Canvas widget, object tags, to keep track of which squares had been selected. When the user clicks a sprinkle, we are able to find which square (rectangle object) it’s represented by and place a selected tag on it. Once the user is done, we can go back and get all the sprinkles that had been tagged to determine the location and size of the 3D shape. To allow for better visibility of where and how big the object will be, when a square is selected, it changes colors. There is also a deselect feature (enacted by clicking on an already selected sprinkle) which removes the selected tag and changes the color back to black.

In order to allow the user to easily select the image they wish to sprinklize, we have implemented a file picker, available through a “Choose your destiny” menu option.

After getting a basic GUI set up and having a way for users to easily select regions of their image, we thought it would be inice to allow for different textures in the 3D object. These may be especially useful in the future if, for instance, one would like to differentiate between colors in a diagram.

We attempted to do this by creating a “field” of tiny cones inside the selected area. This didn’t turn out as well as we had hoped as the cones were too small for the printer to produce. However, we will most likely come back to this feature in the future and see if we can tweak it for better results.

Advertisement

Leave a Reply

Powered by WP Hashcash