CS 251: Assignment #2

Building a GUI in Python

For this assignment, you will create a graphical user interface [GUI] using python and the Tkinter library. We'll go over the main concepts in class, but they're also laid out for you here. You'll be building your system on top of this program throughout the semester, so take time to comment the code and make sure you understand it.

Each of you should do the first two programming tasks individually so you understand the code and the system. When you write up the assignment, just make a brief wiki page on your own to describe your work.

Tasks 3 and 4 you should do with your group. Make a single wiki page for your group for this part of project. You will be expanding this page over the course of the next few assignments. Make sure each member of your group can contribute to the group wiki page.


Tasks

Before you begin, download the skeleton python file for creating a window and menus using the Tkinter package. Rename the file to display.py or something you like. To run the program, open a Terminal and type the following command.

python display.py

If you're not yet comfortable with Python, there are python books in the Safari Online collection. Work through a few examples so you get a sense for how it works.

There are a number of useful tutorials and documentation sites on Tkinter. You should go through a few of them before continuing with the rest of the assignment.

The basic functionality of the skeleton application is that if the user clicks with the right mouse button it draws an oval in that location and adds it to a list. If the user clicks and drags with the first mouse button, it moves all of the points to follow the mouse. Look at the code and make sure you understanding.

  1. Using the three menu options in the command menu, give the user the ability to select the shape drawn when they click in the window. For example, you could let the user select between a circle, a square, and a cross. You will need a state variable that is modified by the menu functions and you will need to edit the handleButton1 function so that it draws a different shape depending upon the current shape selection.

    Make sure the scrolling with button 1 still works after you have implemented this capability.

  2. The Open... command in the file menu asks the user to select a file, but does nothing with it. Using this file, have your program put a shape at each location given in the file, where the shape is determined by the current shape option variable you defined in the first task. Each row has two numbers on it that are the x and y coordinates for where to draw the circle.

    Make sure the scrolling with button 1 still works after you implement this capability.

  3. With your partner/group, pick a data set from the available projects on campus. The current list of choices includes, but is not limited to, the following.

    • Colby Alumni Giving data
      Contact: Lisa Burton
    • Bird migration data
      Contact: Prof. Herb Wilson
    • Purple Finch banding data
      Contact: Prof. Herb Wilson
    • Student survey data
      Contact: Prof. Mike Donihue
    • Elemental concentrations in fossil soil layers
      Contact: Cassi Knight, Prof. Robert Gastaldo
    • Maine lake temperature and elemental concentration data
      Contact: Prof. Whitney King
    • Colby web access data
      Contact: Robert Clockedile
    • Data on Atheletes in Maine
      Contact: Prof. Paul Berkner

  4. Organize a 30-45 minute meeting with your potential client. Listen to what they would like to visualize or discover from the data. Ask questions until you have a good understanding of what the most important issues are. If you don't already have the data, work with your client to get access to it. Take appropriate safeguards if the data is valuable or needs to have limited circulation.

    Some questions you may want to ask include the following.

    • What is the form of the data?
    • What meta-data is available?
    • How was the data collected?
    • If the data was collected using a sensor, does the client have information about the amount of noise in the sensor?
    • What visualizations would be helpful?
    • What kind of computer system will the client be using?
    • Are there dependent variables?
    • Is there missing data? How is it represented in the data set?
    • What options would the client want in visualizations?
    • Does the client want interactive visualizations?
    • What are the questions the data is/will be used to answer?

Extensions


Writeup

As noted, make a brief individual writeup of your TK coding. Don't worry about pictures unless they're really cool.

With your group, make a home wiki page for your data project. All members should have access to this, although it will live in one member's wiki space. For this week's writeup, make two child pages from the main data project page.

  1. One child page should contain all meta-data for the project. This should include a description of the raw data format.
  2. The second child page should contain a summary of your first meeting with your client. Include the main goals of the project and a discussion of the most important features of the project.

Handin

Once you have written up your assignment, give the page the label:

cs251s10project2

Put your code in the COMP/CS251 folder on fileserver1/Academics.