Software Carpentry Day 11: Web Server and GUI Programming
Morning: Web Server Programming
- 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.
- 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?
- 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
- Make a GUI such that typing into an Entry updates the text of a
Label as you type.
- Think about and discuss: What is the relationship between the
Model-View-Controller pattern and Tkinter Mutable Variables such as
StringVar?
- Advanced GUI creation: Build a GUI for the Molecule
Database. Expose as much functionality as you can.
- Exploration: Find a list of Tkinter components. Write a small
program that uses five new components in a creative way.
- Design discussion: In the context of Fitt's Law, discuss the
difference between the Mac OS X menu design and the Windows menu
design.
- Design exercise: Find an ugly business card or campus
advertisement and redesign it to use Contrast, Repetition, Alignment
and Proximity
- 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.