-
Notifications
You must be signed in to change notification settings - Fork 2
HFP CH 8
(guis and data)
35 Pages Long
Description:
Chapter 8, more GUI work. This time with data entry. In this chapter you learn more tkinter tools that allow users to enter data and for you to properly store it. No sounds this time so the chapter went off with out a hitch. In this chapter you also learn about the MVC (Model, View, Controller) and how to use data models to separate your data from your views.
The Code:
In this chapter you build a shipping application. It allows a user to select a shipping depot. Input a description and apply there address. At the bottom you have a save/submit button. Very simple app. You build it a few different ways through out the chapter giving and showing you wrongs and rights when building a GUI that users will use.
Main Concepts Covered:
- MVC - Model, View, Controller.
- Think of widgets as views.
- Use data models to keep your data separate from your views.
- Radio buttons work together if they share a model.
- Object API - the application programmer interface provided by an object.
- Populate a GUI widget dynamically and on - demand.
Python Tools Covered:
-
Entry()
- used by tkinter to enter small amounts of text - one line. -
Text()
- handle multi-line text in tkinter. - Entry fields are indexed from
0
. - Text fields are indexed with a "row. column" string, starting with "
1.0
". - The tkinter controller - keeps the views informed about data changes.
-
StringVar()
- a tkinter stringed variable that can update the GUI "as if by magic" -
RadioButton()
- useful for when you want to select one item from a group in tkinter. -
OptionMenu()
- useful for when you want to elect one item from a LARGE group of items in tkinter.