MCS 260 Fall 2020
Emily Dumas
Build a tkinter GUI application to encode text by rotating each letter forward in the alphabet by a fixed number of places.
A good way to make GUI applications is to subclass tkinter.Tk and put GUI setup code in __init__.
Then, application data can be stored as class attributes.
Commands and other callbacks can be methods.
These options for .grid of a widget make it span multiple columns or rows in the layout.
tkinter offers mutable variable classes designed to work with widgets:
tkinter.StringVar — mutable stringtkinter.DoubleVar — mutable floattkinter.IntVar — mutable integerAll use .set(val) to set, .get() to get. They automatically notify widgets that use them of changes.
tkinter variables let us register a function to be called whenver the value changes:
tkvar.trace_add("write",callback)
The function callback is called with three arguments (internal name, internal index, operation). Usually you want to ignore all of these arguments.
Tk.title(s) sets the window title (in title bar).