Software Carpentry Day 11: Web Server and GUI Programming

Morning: Web Server Programming

  1. Make a copy of the nitinat_2.py program that has been placed in the nitinat directory in your Subversion repository. Using the parsePath method from nitinat_5.py as a starting point, modify nitinat_2.py so that a query of the form http://localhost:8080/test.txt?lines=3 will return the first 3 lines of the file test.txt.

Afternoon: GUI Programming

Choose some exercises from set below. Do as many as you can.

  1. Make a GUI with two text boxes and a button in a row with a label below them. When you click the button, put the sum of the text box contents in the label. What happens when a text box contains a string that isn't a number?
  2. Make a GUI that allows you to change the font of a label by typing the name of the font into a text box and pressing a button. Hint: You will want to look up a method called config
  3. Make a GUI such that typing into an Entry updates the text of a Label as you type.
  4. Think about and discuss: What is the relationship between the Model-View-Controller pattern and Tkinter Mutable Variables such as StringVar?
  5. Advanced GUI creation: Build a GUI for the Molecule Database. Expose as much functionality as you can.
  6. Exploration: Find a list of Tkinter components. Write a small program that uses five new components in a creative way.
  7. Design discussion: In the context of Fitt's Law, discuss the difference between the Mac OS X menu design and the Windows menu design.
  8. Design exercise: Find an ugly business card or campus advertisement and redesign it to use Contrast, Repetition, Alignment and Proximity
  9. Demonstrating Fitt's Law: Design a GUI game that randomly positions a button of random size on the screen. Whenever you click it, change its size and position randomly. Keep track of the time between clicks and the size and position parameters. Try to discover the equation relating the three.