コード例 #1
0
ファイル: simpleedit.py プロジェクト: Calvin-WangA/learning
 def __init__(self,parent=None, file=None):
     frm = Frame(parent)
     frm.pack(fill=X)
     Button(frm,text='Save',command=self.onSave).pack(side=LEFT)
     Button(frm,text='Cut', command=self.onCut).pack(side=LEFT)
     Button(frm,text='Paste', command=self.onPaste).pack(side=LEFT)
     Button(frm,text='Find', command=self.onFind).pack(side=LEFT)
     Quitter(frm).pack(side=LEFT)
     ScrolledText.__init__(self,parent,file=file)
     self.text.config(font=('courier',9,'normal'))
コード例 #2
0
 def __init__(self, parent=None, file=None):
     frm = Frame(parent)
     frm.pack(fill=X)
     Button(frm, text='Save', command=self.onSave).pack(side=LEFT)
     Button(frm, text='Cut', command=self.onCut).pack(side=LEFT)
     Button(frm, text='Paste', command=self.onPaste).pack(side=LEFT)
     Button(frm, text='Find', command=self.onFind).pack(side=LEFT)
     Quitter(frm).pack(side=LEFT)
     ScrolledText.__init__(self, parent, file=file)
     self.text.config(font=('courier', 12, 'normal'))
コード例 #3
0
	def browser(self, filename):
		new = Toplevel()
		view = ScrolledText(new, file=filename)
		view.text.config(height=30, width=85)
		view.text.config(font=('courier', 10,'normal'))
		new.title('Text Viewer')
		new.iconname('browser')
コード例 #4
0
    def __init__(self, parent=None, file=None):

        
        frm = Frame(parent)
        frm.pack(fill=X)
        Button(frm, text="Выбрать каталог с логами", command=self.onStat).pack(side=LEFT)
        Button(frm, text='Сохранить', command=self.onSave).pack(side=LEFT)
        Quitter(frm).pack(side=LEFT)
        ScrolledText.__init__(self, parent, file=file)
        self.text.config(font=('courier', 9, 'normal'))

        self.pattern_SQL = r'SQLCODE=-[0-9][0-9][0-9]'
        self.pattern_E = r'\s[A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9]E'
        self.pattern_JMS = r'JMS\w{1,6}\d{4}'

        self.types_of_stat = ['Сообщения об ошибках', 'Сообщения JMS', 'Сообщения DB2']
コード例 #5
0
 def browser(self, filename):
     new  = Toplevel()                                # make new window
     view = ScrolledText(new, file=filename)          # Text with Scrollbar
     view.text.config(height=30, width=85)            # config Text in Frame
     view.text.config(font=('courier', 10, 'normal')) # use fixed-width font
     new.title("Text Viewer")                         # set window mgr attrs
     new.iconname("browser")                          # file text added auto
コード例 #6
0
 def browser(self, filename=None):
     if not filename:
         filename = self.selectOpenFile()
     new = Toplevel()
     view = ScrolledText(parent=new, file=filename)
     view.text.config(height=30, width=85)
     view.text.config(font=('courier', 10, 'normal'))
     new.title('Text viewer')
コード例 #7
0
 def __init__(self, parent=None, file=None):
     Frame.__init__(self, parent)
     self.pack()
     frm = Frame(self)
     frm.pack(fill=X)
     Button(frm, text='Save', command=self.onSave).pack(side=LEFT)
     Button(frm, text='Cut', command=self.onCut).pack(side=LEFT)
     Button(frm, text='Paste', command=self.onPaste).pack(side=LEFT)
     Button(frm, text='Find', command=self.onFind).pack(side=LEFT)
     Quitter(frm).pack(side=LEFT)
     self.st = ScrolledText(self, file=file)  # attach, not subclass
     self.st.text.config(font=('courier', 9, 'normal'))
コード例 #8
0
ファイル: simpleedit2.py プロジェクト: madtyn/progPython
class SimpleEditor(Frame):  # see PyEdit for more
    def __init__(self, parent=None, file=None):
        super().__init__(parent)
        #Frame.__init__(self, parent)
        self.pack()
        frm = Frame(self)
        frm.pack(fill=X)
        Button(frm, text='Save', command=self.onSave).pack(side=LEFT)
        Button(frm, text='Cut', command=self.onCut).pack(side=LEFT)
        Button(frm, text='Paste', command=self.onPaste).pack(side=LEFT)
        Button(frm, text='Find', command=self.onFind).pack(side=LEFT)
        Quitter(frm).pack(side=LEFT)
        self.st = ScrolledText(self, file=file)
        self.st.text.config(font=('courier', 9, 'normal'))

    def onSave(self):
        filename = asksaveasfilename()
        if filename:
            alltext = self.st.gettext()  # first through last
            open(filename, 'w').write(alltext)  # store text in file

    def onCut(self):
        text = self.st.text.get(SEL_FIRST, SEL_LAST)  # error if no select
        self.st.text.delete(SEL_FIRST, SEL_LAST)  # should wrap in try
        self.clipboard_clear()
        self.clipboard_append(text)

    def onPaste(self):  # add clipboard text
        try:
            text = self.selection_get(selection='CLIPBOARD')
            self.st.text.insert(INSERT, text)
        except TclError:
            pass  # not to be pasted

    def onFind(self):
        target = askstring('SimpleEditor', 'Search String?')
        if target:
            where = self.st.text.search(target, INSERT,
                                        END)  # from insert cursor
            if where:  # returns an index
                print(where)
                pastit = where + ('+%dc' % len(target))  # index past target
                #self.st.text.tag_remove(SEL, '1.0', END)      # remove selection
                self.st.text.tag_add(SEL, where, pastit)  # select found target
                self.st.text.mark_set(INSERT, pastit)  # set insert mark
                self.st.text.see(INSERT)  # scroll display
                self.st.text.focus()  # select text widget
コード例 #9
0
ファイル: simpleedit2.py プロジェクト: liubiggun/PP4E
class SimpleEditor(Frame):                                # see PyEdit for more
    def __init__(self, parent=None, file=None):
        Frame.__init__(self, parent)
        self.pack()
        frm = Frame(self)
        frm.pack(fill=X)
        Button(frm, text='Save',  command=self.onSave).pack(side=LEFT)
        Button(frm, text='Cut',   command=self.onCut).pack(side=LEFT)
        Button(frm, text='Paste', command=self.onPaste).pack(side=LEFT)
        Button(frm, text='Find',  command=self.onFind).pack(side=LEFT)
        Quitter(frm).pack(side=LEFT)
        self.st = ScrolledText(self, file=file)
        self.st.text.config(font=('courier', 9, 'normal'))

    def onSave(self):
        filename = asksaveasfilename()
        if filename:
            alltext = self.st.gettext()                      # first through last
            open(filename, 'w').write(alltext)            # store text in file

    def onCut(self):
        text = self.st.text.get(SEL_FIRST, SEL_LAST)         # error if no select
        self.st.text.delete(SEL_FIRST, SEL_LAST)             # should wrap in try
        self.clipboard_clear()
        self.clipboard_append(text)

    def onPaste(self):                                    # add clipboard text
        try:
            text = self.selection_get(selection='CLIPBOARD')
            self.st.text.insert(INSERT, text)
        except TclError:
            pass                                          # not to be pasted

    def onFind(self):
        target = askstring('SimpleEditor', 'Search String?')
        if target:
            where = self.st.text.search(target, INSERT, END)  # from insert cursor
            if where:                                      # returns an index
                print(where)
                pastit = where + ('+%dc' % len(target))    # index past target
               #self.st.text.tag_remove(SEL, '1.0', END)      # remove selection
                self.st.text.tag_add(SEL, where, pastit)      # select found target
                self.st.text.mark_set(INSERT, pastit)         # set insert mark
                self.st.text.see(INSERT)                      # scroll display
                self.st.text.focus()                          # select text widget
コード例 #10
0
 def popupnow(self, parent=None):
     if self.text: return
     self.text = ScrolledText(parent or Toplevel())
     self.text.text.config(font=self.font, width=150)
コード例 #11
0
xmove_indicate.pack(fill="both", anchor=tki.W)

ymove_val = 0
ymove_str = tki.StringVar()
ymove_str.set('  Y move : No Sense')
ymove_indicate = tki.Label(textvariable=ymove_str,
                           width=15,
                           anchor=tki.W,
                           justify='left',
                           foreground='#ffffff',
                           background='#007f00',
                           font=("", 32))
ymove_indicate.pack(fill="both", anchor=tki.W)

txtbox_lines = 0
txtbox = ScrolledText()
txtbox.pack()

ports = list_ports.comports()
devices = [info.device for info in ports]
if len(devices) == 0:
    print("error: device not found")
else:
    print("found: device %s" % devices[0])
comdev = serial.Serial(devices[0], baudrate=115200, parity=serial.PARITY_NONE)
#comdev = serial.Serial('COM1', baudrate=115200, parity=serial.PARITY_NONE)


def set_distance(arg):
    if arg > 0 and arg < 100000:
        distance_val = arg
コード例 #12
0
ファイル: EventsDemo.py プロジェクト: sanyaade-iot/scratch
            pass
        rpt = "%s\n\n" % rpt
        st.addText(rpt)
        st.see(END)
        print event.time
        if self.MustBreak.get():
            return "break"


root = Tk()
root.title("Tkinter events demo")

eventTB = Toolbar(root, side=RIGHT)
eventTB.pack()

frmTest = Frame(root)
frmTest.pack(expand=YES, fill=Y, side=LEFT)

st = ScrolledText(root, side=LEFT)

Label(frmTest, text="Test widgets", relief=RIDGE).pack(fill=X, pady=2)
Label(frmTest, text="\n").pack(fill=X)
ent = Entry(frmTest, bg="white", name="entry")
ent.pack(side=TOP, fill=X)
lbl = Label(frmTest, text="Test Label", relief=RIDGE, name="label")
lbl.pack(side=TOP, fill=X)
Button(frmTest, text="Clear Text", command=st.clear).pack(side=BOTTOM, fill=X)

widgets = (ent, lbl)

mainloop()