[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
h a m ::::::::::::::::::::textpak=>spam.txt spam Spam SPAM These scripts don’t do anything about binary files, compression, o ...
row.pack(fill=X) # uses packed row frames lab.pack(side=LEFT) # and fixed-width labels ent.pack(side=LEFT, expand=YES, fill=X) # ...
When run standalone, the “popup” button of script in Example 10-10 creates the input form shown in Figure 10-6; this is also wha ...
win = Toplevel() win.title('Enter Unpack Parameters') var = makeFormRow(win, label='Input file', width=11) win.bind('', lambda e ...
C:\...\PP4E\Gui\ShellGui\temp> python ..\mytools.py list PP4E scrolledtext list test Packer: packed.all ['spam.txt', 'ham.txt ...
Example 10-12. PP4E\Gui\Tools\guiStreams.py """ ############################################################################### ...
text = '' # read all till eof line = self.buff while line: text = text + line line = self.inputLine() # until cancel=eof='' retu ...
output.write(line.lower()) print('end of file') root = Tk() Button(root, text='test streams', command=lambda: redirectedGuiFunc( ...
they won’t return to the GUI’s event loop until the function or shell command exits. Although GuiOutput takes care to call tkint ...
mytools.py in Example 10-6 to register code like the function wrapper here as its call- back handlers. In fact, you can use this ...
explicitly request reloading of the modules that you change, but you must also generally provide an indirection layer that route ...
print('spamSpamSPAM') # or could build a dialog... def message2(self): print('Ni! Ni!') # change me self.method1() # access the ...
from these directly, or be mixed together with them per usage mode; may also be called directly without a subclass; designed to ...
def init(self, app, kind='', iconfile=None): Tk.init(self) self.__app = app self.configBorders(app, kind, iconfile) def quit(sel ...
higher-level functionality that we might otherwise have to code redundantly. Among other things, the classes arrange for automat ...
Button(self, text='Pine', command=self.quit).pack() Button(self, text='Sing', command=self.destroy).pack() contentsub() non-clas ...
GUIs, Threads, and Queues In Chapter 5, we learned about threads and the queue mechanism that threads typically use to communica ...
specific process-based roles; servers provide data sources which are longer-lived and more loosely coupled (though a GUI can als ...
def producer(id): for i in range(5): time.sleep(0.1) print('put') dataQueue.put('[producer id=%d, count=%d]' % (id, i)) def cons ...
Recoding with classes and bound methods Example 10-19 takes the model one small step further and migrates it to a class to allow ...
«
29
30
31
32
33
34
35
36
37
38
»
Free download pdf