[Python编程(第4版)].(Programming.Python.4th.Edition).Mark.Lutz.文字版
if name == 'main': from textConfig import ( # my dir is on the path opensAskUser, opensEncoding, savesUseKnownEncoding, savesAsk ...
), ('Edit', 0, [('Undo', 0, self.onUndo), ('Redo', 0, self.onRedo), 'separator', ('Cut', 0, self.onCut), ('Copy', 1, self.onCopy ...
vbar.config(command=text.yview) # call text.yview on scroll move hbar.config(command=text.xview) # or hbar['command']=text.xview ...
file = loadFirst or self.my_askopenfilename() if not file: return if not os.path.isfile(file): showerror('PyEdit', 'Could not op ...
if text == None: showerror('PyEdit', 'Could not decode and open file ' + file) else: self.setAllText(text) self.setFileName(file ...
try user input, prefill with known type, else next choice if not encpick and self.savesAskUser: self.update() # else dialog does ...
self.clearAllText() self.text.edit_reset() # 2.0: clear undo/redo stks self.text.edit_modified(0) # 2.0: clear modified flag sel ...
def onCut(self): if not self.text.tag_ranges(SEL): showerror('PyEdit', 'No text selected') else: self.onCopy() # save and delete ...
pastkey = where + '+%dc' % len(key) # index past key self.text.tag_remove(SEL, '1.0', END) # remove any sel self.text.tag_add(SE ...
tree to be input, preset it to the platform filesystem or text default, and skip files that fail to decode; in worst cases, user ...
sys.getfilesystemencoding() if not None? see also Chapter6 footnote issue: 3.1 fnmatch always converts bytes per Latin-1; """ fr ...
loadFirst=file, winTitle=' grep match', loadEncode=encoding) editor.onGoto(int(line)) editor.text.focus_force() # no, really new ...
open a new edit window without changing one already open (onNew); inherits quit and other behavior of the window that it clones; ...
if sys.platform[:3] == 'win': # spawn in parallel run = StartArgs if cmdargs else Start # 2.1: support args run(thecmd, thecmd)( ...
self.currfile = name # for save self.filelabel.config(text=str(name)) def setKnownEncoding(self, encoding='utf-8'): # 2.1: for s ...
################################### when text editor owns the window ################################### class TextEditorMain(Te ...
GuiMaker.init(self, self.popup) # use main window menus TextEditor.init(self, loadFirst, loadEncode) # a frame in a new popup as ...
TextEditor.init(self, loadFirst, loadEncode) # TextEditor adds middle def start(self): TextEditor.start(self) # GuiMaker start c ...
straightforward: given a directory of image files, PyPhoto displays their thumbnails in a scrollable canvas. When a thumbnail is ...
or displaying a simple one-button window that allows you to select directories to open on demand, when no initial directory is g ...
«
33
34
35
36
37
38
39
40
41
42
»
Free download pdf