Event Binding 1

Happily, lambda also gives us a way to parameterize event binding. Instead of self.buttonHandler a event, button name, 1, Good stuff which wouldn't work, because there was no way to include the event argument in the argument list , we can use lambda, this way event binding -- passing the event as an argument self.button1.bind , event, arg1 button name, arg2 1, arg3 Good stuff self.buttonHandler a event, arg1, arg2, arg3 Note that event here is a variable name -- it is not a Python keyword or...

Some Technical Terminology orientation

Vertical orientation includes the TOP and BOTTOM sides. Horizonal orientation includes the LEFT and RIGHT sides. When you are packing widgets and containers, it is possible to mix the two orientations. For example, we could have packed one button with a vertical orientation say, TOP and the other button with a horizontal orientation say, LEFT . But mixing orientations inside a container this way is not a good idea. If you use mixed orientations, then predicting what the final result will look...

Curry How To Use It

The way to use curry the technique is to include a curry class in your program, or to import it from its own Python file. In this program, we will include the curry code directly in the program. Originally, we thought that the following statement could bind self.buttonHandler to self.buttonl's command option, but we found out that it didn't work the way we thought it would. self.button1 Button self.myContainer1, command self.buttonHandler button name, 1, Good stuff Using curry, the way to do...

The Four Basic Guiprogramming Tasks

When you develop a user interface UI there is a standard set of tasks that you must accomplish. 1 You must specify how you want the UI to look . That is, you must write code that determines what the user will see on the computer screen. 2 You must decide what you want the UI to do . That is, you must write routines that accomplish the tasks of the program. 3 You must associate the looking with the doing. That is, you must write code that associates the things that the user sees on the screen...

Frames Are Elastic

A frame is basically a container. The interior of a container -- the space as it were, inside the container -- is called the cavity. Cavity is a technical term that Tkinter gets from Tk. This cavity is stretchy or elastic, like a rubber band. Unless you specify an minimum or maximum size for the frame, the cavity will stretch or shrink to accommodate whatever is placed inside the frame. In the previous program, because we hadn't put anything into it, the root displayed itself with its default...

Thinking in Tkinter

by Stephen Ferg steve ferg.org revised 2005-07-17 This file contains the source code for all of the files in the Thinking in Tkinter If you print this file with a small font, you should be able to print it in portrait mode without truncating the ends of any of the lines of code. If you print it, and find that you ARE truncating lines of code, consider printing it in a smaller font, or printing it in landscape mode. Printed size is approximately 40 to 60 pages, depending on your print settings....