target, INSERT, END, nocase = True ) if where : # print(where) # _remove(SEL, '1.0', END) pastit = 'c'. target = askstring ( 'SimpleEditor', 'Search String?', initialvalue = self. selection_get ( selection = 'CLIPBOARD' )) except TclError : pass def onFind ( self ): self. delete ( SEL_FIRST, SEL_LAST ) def onPaste ( self ): try : self. target = '' def onSave ( self ): filename = asksaveasfilename ( defaultextension = '.txt', filetypes = (( 'Text files', '*.txt' ), ( 'Python files', '*.py *.pyw' ), ( 'All files', '*.*' ))) if filename : with open ( filename, 'w' ) as stream : stream. pack ( side = LEFT ) Button ( frm, text = 'Find', command = self. pack ( side = LEFT ) Button ( frm, text = 'Paste', command = self. pack ( side = LEFT ) Button ( frm, text = 'Cut', command = self. pack ( fill = X ) Button ( frm, text = 'Save', command = self. From tkinter import * from tkinter.filedialog import asksaveasfilename from tkinter.simpledialog import askstring from ssagebox import askokcancel # class SimpleEditor ( ScrolledText ): def _init_ ( self, parent = None, file = None ): frm = Frame ( parent ) frm.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |