ADBRITE ads links
You are here: CodeIdol.com > Python > Programming Python, 3rd Edition > Graphical User Interfaces
Programming Python, 3rd Edition
| 8.1. "Here's Looking at You, Kid"
For most software systems, a graphical user interface (GUI) has become an expected part of the package. Even if the GUI acronym is new to you, chances are that you are already familiar with such interfacesi.e., th...
|
|
| 8.2. Python GUI Development Options
Before we start wading into the Tkinter
pond, let's begin with some perspective on Python GUI options in general. Because Python has proven to be such a good match for GUI work, this domain has seen much...
|
|
| 8.3. Tkinter Overview
Of all these GUI options, though, Tkinter is by far the de facto standard way to implement portable user interfaces in Python today, and the focus of this part of the book. The rationale for this approach was explained i...
|
|
| 8.4. Climbing the GUI Learning Curve
On to the code; let's start out by quickly stepping through a few small examples that illustrate basic concepts, and show the windows they create on the screen. The examples will become more sophisticated as we...
|
|
| 8.5. Tkinter Coding Basics
The gui1 script is a trivial example, but it illustrates steps common to most Tkinter programs. This Python code does the following:
Loads a widget class from the Tkinter moduleMakes an instance of the import...
|
|
| 8.6. Tkinter Coding Alternatives
As you might expect, there are a variety of ways to code the gui1 example. For instance, if you want to make all your Tkinter imports more explicit in your script, grab the whole module and prefix all of its n...
|
|
| 8.7. Adding Buttons and Callbacks
So far, we've learned how to display messages in labels, and we've met Tkinter core concepts along the way. Labels are nice for teaching the basics, but user interfaces usually need to do a bit...
|
|
| 8.8. Adding User-Defined Callback Handlers
In the simple button examples in the preceding section, the callback handler was simply an existing function that killed the GUI program. It's not much more work to register callback handlers that...
|
|
| 8.9. Adding Multiple Widgets
It's time to start building user interfaces with more than one widget. Example 8-17 makes the window shown in Figure 8-14.
Figure 8-14. A multiple-widget window
Example 8-17. PP3E\Gui\Intro\gui4....
|
|
| 8.10. Customizing Widgets with Classes
You don't have to use OOP in Tkinter scripts, but it can definitely help. As we just saw, Tkinter GUIs
are built up as class-instance object trees. Here's another way Python's OOP features can b...
|
|
| 8.11. Reusable GUI Components with Classes
Larger GUI interfaces are often built up as subclasses of Frame, with callback handlers implemented as methods. This structure gives us a natural place to store information between events: i...
|
|
| 8.12. The End of the Tutorial
In this chapter, we learned the core concepts of Python/Tkinter programming and met a handful of simple widget objects along the waye.g., labels, buttons, frames, and the packer geometry manager. We've seen enough to ...
|
|
| 8.13. Python/Tkinter for Tcl/Tk Converts
At the start of this chapter, I mentioned that Tkinter is Python's interface to the Tk GUI library, originally written for the Tcl language.
To help readers migrating from Tcl to Pytho...
|
|
You are here: CodeIdol.com > Python > Programming Python, 3rd Edition > Graphical User Interfaces
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|