[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
To make all of these grow along with their window, though, we also need to make the container frame expandable; widgets expand b ...
The default anchor is CENTER, so widgets show up in the middle of their space (the cavity side they were given) unless they are ...
OOP features can be applied to GUI models: specializing widgets by inheritance. Example 7-18 builds the window in Figure 7-19. E ...
Common behavior Example 7-18 standardizes behavior—it allows widgets to be configured by subclassing instead of by passing in op ...
This code is something of a preview; see file gui5b-themed.py in the examples package for a complete version, and watch for more ...
We’ll meet such a text editor component in Chapter 11. For now, Example 7-20 illus- trates the concept in a simple way. The scri ...
scope of the module file containing the widget calls. This works for simple GUIs but can make for brittle code when building up ...
Figure 7-21. An attached class component on the right This script just adds Hello’s button to the right side of parent—a contain ...
can be much larger. If you imagine replacing the Hello call in this script with a call to attach an already coded and fully debu ...
Frame) is the added button’s callback handler. The net effect is that this class customizes the original to add a new button and ...
When run, the Hye button here prints to stdout and the Bye button closes and exits the GUI, much as before: C:\...\PP4E\Gui\Intr ...
part.pack(side=RIGHT) # FAILS!--need part.top.pack(side=RIGHT) frm.mainloop() This won’t quite work, because part isn’t really a ...
table lists only widget classes; along the way, we will also meet a few additional widget- related topics that don’t appear in t ...
Scheduled callbacks Widget after, wait, and update methods Other tools Standard dialogs, clipboard, bind and Event, widget confi ...
Linked variables (next chapter) Variables associated with widgets are tkinter class objects with methods. In Python, widget crea ...
...
CHAPTER 8 A tkinter Tour, Part 1 “Widgets and Gadgets and GUIs, Oh My!” This chapter is a continuation of our look at GUI progra ...
Images: PhotoImage and BitmapImage objects Widget and window configuration options Dialogs, both standard and custom Low-level ...
background, and with a font that’s very different from what we’ve seen so far. In fact, this script customizes the label in a nu ...
Layout and expansion Finally, the label is made generally expandable and stretched by setting the pack expand and fill options w ...
«
18
19
20
21
22
23
24
25
26
27
»
Free download pdf