GIF89a; EcchiShell v1.0
//lib64/lib64/lib64/lib64/python2.7/Demo/', single1) def double1(e): x = e.x y = e.y t.setvar('tk_priv(selectMode)', 'word') t.tk_textSelectTo(At(x, y)) t.bind('', double1) def triple1(e): x = e.x y = e.y t.setvar('tk_priv(selectMode)', 'line') t.tk_textSelectTo(At(x, y)) t.bind('', triple1) def returnkey(e): t.insert(AtInsert(), '\n') invoke() t.bind('', returnkey) def controlv(e): t.insert(AtInsert(), t.selection_get()) t.yview_pickplace(AtInsert()) if t.index(AtInsert())[-2:] == '.0': invoke() t.bind('', controlv) # 4. Procedure to backspace over one character, as long as # the character isn't part of the prompt. def backspace(e): if t.index('promptEnd') != t.index('insert - 1 char'): t.delete('insert - 1 char', AtInsert()) t.yview_pickplace(AtInsert()) t.bind('', backspace) t.bind('', backspace) t.bind('', backspace) # 5. Procedure that's invoked when return is typed: if # there's not yet a complete command (e.g. braces are open) # then do nothing. Otherwise, execute command (locally or # remotely), output the result or error message, and issue # a new prompt. def invoke(): cmd = t.get('promptEnd + 1 char', AtInsert()) if t.getboolean(tk.call('info', 'complete', cmd)): # XXX if app == root.winfo_name(): msg = tk.call('eval', cmd) # XXX else: msg = t.send(app, cmd) if msg: t.insert(AtInsert(), msg + '\n') prompt() t.yview_pickplace(AtInsert()) def prompt(): t.insert(AtInsert(), app + ': ') t.mark_set('promptEnd', 'insert - 1 char') t.tag_add('bold', 'insert linestart', 'promptEnd') # 6. Procedure to select a new application. Also changes # the prompt on the current command line to reflect the new # name. def newApp(appName): global app app = appName t.delete('promptEnd linestart', 'promptEnd') t.insert('promptEnd', appName + ':') t.tag_add('bold', 'promptEnd linestart', 'promptEnd') def fillAppsMenu(): file_m_apps.add('command') file_m_apps.delete(0, 'last') names = root.winfo_interps() names = list(names) names.sort() for name in names: try: root.send(name, 'winfo name .') except TclError: # Inoperative window -- ignore it pass else: file_m_apps.add_command( label=name, command=lambda name=name: newApp(name)) file_m_apps['postcommand'] = fillAppsMenu mBar.tk_menuBar(file) # 7. Miscellaneous initialization. app = root.winfo_name() prompt() t.focus() root.mainloop()