[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
if name == 'main': import sys root = Tk() root.title('Summer Grid') if len(sys.argv) != 3: SumGrid(root).pack() # .grid() works ...
Figure 9-39. Data file loaded, displayed, and summed Figure 9-37. Adding datafile loads Figure 9-38. Opening a data file for Sum ...
The grid5-data2.txt datafile has the same dimensions but contains expressions in two of its columns, not just simple numbers. Be ...
upon other cells. In the interest of space, further mutations toward that goal are left as exercises. I should also point out th ...
add a delay in time-sensitive displays (e.g., animation programs such as PyDraw and the simpler examples ahead). widget.after_id ...
widget.wait_variable(var) widget.wait_window(win) widget.wait_visibility(win) These tools pause the caller until a tkinter varia ...
This GUI thread story is prone to change over time, but it imposes a few structural constraints on programs. For example, becaus ...
def init(self, msecs=1000): # default = 1 second Frame.init(self) self.msecs = msecs self.pack() stopper = Button(self, text='St ...
Hiding and redrawing widgets and windows The button flash method flashes the widget, but it’s easy to dynamically change other a ...
The state method returns or changes the window’s current state—it accepts normal, iconic, zoomed (full screen), or withdrawn. ...
control to the GUI event loop—any new requests that arrive during a move are deferred. Because of that, canvas.update must be ca ...
self.canvas.master.bind('', self.onMoveRectangles) self.kinds = self.create_oval_tagged, self.create_rectangle_tagged def create ...
Figure 9-42. Drag-out objects ready to be animated Using widget.after events The main drawback of this first approach is that on ...
Example 9-31. PP4E\Gui\Tour\canvasDraw_tags_after.py """ similar, but with widget.after() scheduled events, not time.sleep loops ...
from tkinter import * import canvasDraw_tags import _thread, time class CanvasEventsDemo(canvasDraw_tags.CanvasEventsDemo): def ...
Other animation effects Besides canvas-based animations, widget configuration tools support a variety of ani- mation effects. Fo ...
For more advanced 3-D animation needs, also see the support in the PIL extension package for common animation and movie file for ...
Moreover, we haven’t even mentioned any of the higher-level widgets available in the popular Pmw, Tix, or ttk extension packages ...
CHAPTER 10 GUI Coding Techniques “Building a Better Mousetrap” This chapter continues our look at building GUIs with Python and ...
of their code is external to this book, we’ll explore enough of their structure to help you study them in the examples distribut ...
«
27
28
29
30
31
32
33
34
35
36
»
Free download pdf