当前位置: 首页>>代码示例>>Python>>正文


Python ScrolledText类代码示例

本文整理汇总了Python中ScrolledText的典型用法代码示例。如果您正苦于以下问题:Python ScrolledText类的具体用法?Python ScrolledText怎么用?Python ScrolledText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ScrolledText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, master):

        def saisie():
            myref = pyP2B()
            resultBox.insert('end', myref.getPubmedReference(valeur.get()))

        valeur = StringVar()
        
        frame = Frame(master)
        frame.pack()

        queryFrame = Frame(frame)
        queryFrame.pack(fill=X)
        
        label = Label(queryFrame, text="PMID: ")
        label.pack(side=LEFT)
        
        entry = Entry(queryFrame, textvariable=valeur, text='        ')
        entry.pack(side=LEFT)
        
        okButton = Button(queryFrame, text="OK", command=saisie)
        okButton.pack(side=LEFT)

        resultFrame = Frame(frame)
        resultFrame.pack(fill=X)

        resultBox = ScrolledText(resultFrame)
        resultBox.pack(side=LEFT)
开发者ID:ggilestro,项目名称:latex-pubmed,代码行数:28,代码来源:pyP2Bgui.py

示例2: compilePythonCode

 def compilePythonCode(self):
     if(self.currentFile):
         self.saveFile()
         original_stdout = sys.stdout
         try:
             a = compiler.compile(self.currentText, self.currentFile, 
                                 mode = "exec")
             # (http://stackoverflow.com/questions/4904079/
             # execute-a-block-of-python-code-with-exec-capturing-all-its-output)
             # captures stdout in temp stringIO buffer to get output
             # and then reverts changes
             buffer = StringIO()
             sys.stdout = buffer
             eval(a)
             sys.stdout = original_stdout
             val = buffer.getvalue()
             rt = Tk()
             outputText = ScrolledText(rt, width = 50)
             outputText.insert(END, val)
             outputText.pack()
             rt.mainloop()
         except:
             print "Error!"
             self.displayMessageBox("Error","There is an error in the code.")
             sys.stdout = original_stdout
     else:
         self.saveAs()
开发者ID:manikpanwar,项目名称:CollaborativeCoder,代码行数:27,代码来源:textEditor.py

示例3: __init__

class editor:
	def __init__(self,rt):
		if rt == None:
			self.t = Tk(rt)
		else:
			self.t = Toplevel(rt)
		self.t.title("Taposh's Editor %d" %len(t1))
		self.bar = Menu(rt)

		self.filem = Menu(self.bar)
		self.filem.add_command(label ="Open..", command =openfile)
		self.filem.add_command(label ="New..", command =newwin)
		self.filem.add_command(label ="Save..", command =savefile)
		self.filem.add_command(label ="Save as..", command =savefile)
		self.filem.add_separator()
		self.filem.add_command(label ="Exit..", command = die)
		self.helpm = Menu(bar)
		self.helpm.add_command(label ="Index..", command =callee)
		self.helpm.add_separator()
		self.helpm.add_command(label ="About..", command =about)
		self.bar.add_cascade(label="File",menu=filem)
		self.bar.add_cascade(label="Help",menu=helpm)
		self.t.config(menu=bar)
		self.f = Frame(self.t,width=512)
		self.f.pack(expand=1,fill=BOTH)

		self.st = ScrolledText(self.f,background="white")
		self.st.pack(side=LEFT, fill=BOTH, expand=1)
开发者ID:taposh,项目名称:texteditor,代码行数:28,代码来源:mytexteditor.py

示例4: create_widgets

    def create_widgets(self, parent, controller):

        self.info = tk.Label(self, text="Enter a stock ticker")
        self.info.pack()

        self.e = ttk.Entry(self)    # entry form for stock symbol
        self.e.pack()

        self.info2 = tk.Label(self, text="Enter timespan (6m, 1y, 3y)")
        self.info2.pack()

        self.span = tk.Entry(self)
        self.span.pack(side=tk.TOP)
        self.span.focus_set()

        self.b = ttk.Button(self, text='Submit', command=lambda: self.get_input())
        # self.b.grid(row=3, column=1, sticky=tk.N)
        self.b.pack(side=tk.TOP)

        self.info3 = tk.Label(self, text="Results")
        self.info3.pack(side=tk.LEFT)

        global text
        text = ScrolledText(self, font=("Consolas",10), padx=10, pady=10)
        text.insert(tk.INSERT, "\n")
        text.pack(side=tk.BOTTOM, expand=True)

        self.b1 = tk.Button(self, text='Event Plot', command=lambda: self.chart_events())
        self.b1.pack(side=tk.RIGHT)
开发者ID:ramenhood,项目名称:StockDataMining,代码行数:29,代码来源:gui2.py

示例5: createTextItem

    def createTextItem(self, frame, sname, name, eid, w, h, cspan=1, rspan=1, txt=""):
        stxt = ScrolledText(frame, width=int(w), height=int(h))
        stxt.insert(END, txt.strip())
        stxt.tag_config("csel", background="blue",foreground="white")
	self.stext[sname+":"+eid] = stxt
	key = name+":gui:"+eid

	return [stxt, cspan, rspan]
开发者ID:okadahiroyuki,项目名称:okada,代码行数:8,代码来源:eSEAT.py

示例6: __init__

class editor:
    def __init__(self, rt):
        if rt == None:
            self.t = Tk()
        else:
            self.t = Toplevel(rt)
        self.t.title("Tkeditor %d" % len(t1))
        self.bar = Menu(rt)

        self.filem = Menu(self.bar)
        self.filem.add_command(label="打开", command=self.openfile)
        self.filem.add_command(label="新建", command=neweditor)
        self.filem.add_command(label="保存", command=self.savefile)
        self.filem.add_command(label="关闭", command=self.close)
        self.filem.add_separator()
        self.filem.add_command(label="退出", command=die)

        self.helpm = Menu(self.bar)
        self.helpm.add_command(label="关于", command=about)
        self.bar.add_cascade(label="文件", menu=self.filem)
        self.bar.add_cascade(label="帮助", menu=self.helpm)
        self.t.config(menu=self.bar)

        self.f = Frame(self.t, width=512)
        self.f.pack(expand=1, fill=BOTH)

        self.st = ScrolledText(self.f, background="white")
        self.st.pack(side=LEFT, fill=BOTH, expand=1)

        self.open = Button(self)
        self.open["text"] = "open"
        self.open["fg"] = "Blue"
        self.open["command"] = self.openfile
        self.open.pack({"side": "left"})
        self.open.pack({"anchor": "nw"})

    def close(self):
        self.t.destroy()
        print "close"

    def openfile(self):
        p1 = END
        oname = askopenfilename(filetypes=[("Python file", "*.*")])
        if oname:
            for line in fileinput.input(oname):
                self.st.insert(p1, line)
            self.t.title(oname)

    def savefile(self):
        sname = asksaveasfilename()
        if sname:
            ofp = open(sname, "w")
            ofp.write(self.st.get(1.0, END))
            ofp.flush()
            ofp.close()
            self.t.title(sname)
开发者ID:shawn0lee0,项目名称:OMOOC2py,代码行数:56,代码来源:notebook_.py

示例7: __init__

class editor:
    def __init__(self,rt):

        self.top=Tk()
        self.top.title('记事本')
        self.top.geometry('300x400')
        self.bar=Menu(self.top)
  
        self.filem=Menu(self.bar)
        self.filem.add_command(label="打开",command=self.openfile)
        self.filem.add_command(label="新建",command=self.neweditor)
        self.filem.add_command(label="保存",command=self.savefile)
        self.filem.add_command(label="关闭",command=self.close)

        self.helpm=Menu(self.bar)
        self.helpm.add_command(label="Help",command=self.about)
        self.bar.add_cascade(label="文件",menu=self.filem)
        self.bar.add_cascade(label="帮助",menu=self.helpm)
        self.top.config(menu=self.bar)
  
        self.f=Frame(self.top,width=512)
        self.f.pack(expand=1,fill=BOTH)
  
        self.st=ScrolledText(self.f,background="white")
        self.st.pack(side=LEFT,fill=BOTH,expand=1)
        
    def close(self):
        self.top.destroy()
 
    def openfile(self):
        p1=END
        oname=askopenfilename()#filetypes=[("Python file","*.*")])
        if oname:
            for line in fileinput.input(oname):
                self.st.insert(p1,line)
                self.top.title(oname)
 
    def savefile(self):
        sname=asksaveasfilename()
        if sname:
            ofp=open(sname,"w")
            ofp.write(self.st.get(1.0,END).encode('utf-8'))
            ofp.flush()
            ofp.close()
            self.top.title(sname)
 
    def neweditor(self):
        global root
        self.top.append(editor(root))
        
        
    def about(self):
        tkMessageBox.showwarning("Tkeditor",'What?\n记事本也要帮助?')
开发者ID:wsywxywr,项目名称:free-mini,代码行数:53,代码来源:final.py

示例8: __init__

 def __init__(self,filenames={}):
   self.a = Tk()
   self.a.wm_title("Makefile Module Summary Logs")
   self.n = notebook(self.a, LEFT)
   self.frames = {}
   for filename in filenames:
     f = Frame(self.n())
     st = ScrolledText(f, width=100, height=50)
     logfile = open(filenames[filename], 'r')
     st.insert(END, logfile.read())
     st.pack()
     self.frames[f] = st
     x = self.n.add_screen(f, filename)
开发者ID:ConicLabs,项目名称:client_component_template,代码行数:13,代码来源:logging_gui.py

示例9: Add_Group

class Add_Group(Frame):
	def __init__(self, parent, app):
		Frame.__init__(self, parent)
		self.parent = parent
		self.app = app

		#Frame to hold Keyword Group new Entry and new keywords text box
		addKGFrame = Frame(parent, bg="#E8E8E8", relief=RAISED)
		addKGFrame.pack(fill=BOTH, expand=True, side=LEFT, padx=10, pady=10)

		#Label for Entry Box
		addGroupLabel = Label(addKGFrame, text="Enter New Group Name",bg="#E8E8E8")
		addGroupLabel.pack(side=TOP)

		#Entry Box for new Keyword Group
		self.addGroup = Entry(addKGFrame, width=30, relief=SUNKEN)
		self.addGroup.pack(side=TOP, fill=X, expand=True, pady=5)

		#Label for New Keywords for Group Text Box
		addKGLabel = Label(addKGFrame, text="Enter New Keywords (Optional)",bg="#E8E8E8")
		addKGLabel.pack(side=TOP, fill=X, expand=True, pady=5)

		#Canvas for Text Box to Enter New Keywords for New Group
		addKGCanvas = Canvas(addKGFrame, bg="#E8E8E8", relief=SUNKEN)
		addKGCanvas.pack(side=TOP, fill=BOTH, expand=True, pady=5)

		#Keywords for new group scrollable text box
		self.addKGText = ScrolledText(addKGCanvas, wrap=WORD, width=25, 
			height=15, relief=SUNKEN, highlightthickness=0, bd=1, padx=1, pady=1)
		self.addKGText.pack(fill=BOTH, side=TOP, expand=True)

		#Button to add new Keyword Group and Keywords
		addKGButton = Button(addKGFrame, text="Add Group", 
			width=30, highlightbackground='#E8E8E8', command=self.group_add)
		addKGButton.pack(side=TOP, fill=BOTH, expand=True)

	#Function to add the keyword group
	def group_add(self):
		newGroup = self.addGroup.get()
		if newGroup != "":
			self.app.key_group.keyword_groups[newGroup] = []

			text = self.addKGText.get('1.0', 'end-1c').splitlines()
			for line in text:
				self.app.key_group.keyword_groups[newGroup].append(line)
			self.app.Groups.groupList.delete(0, END)
			for x in self.app.key_group.keyword_groups:
				self.app.Groups.groupList.insert(END, '%s' % x)

			self.addKGText.delete('1.0', END)
			self.addGroup.delete(0, END)
开发者ID:Cmiller9,项目名称:KW_GRPR,代码行数:51,代码来源:KwGui.py

示例10: GredAboutBox

class GredAboutBox(GatoDialogs.AboutBox):

    def body(self, master):
        self.resizable(0,0)
        self.catIconImage = PhotoImage(data=GatoIcons.gred)
        self.catIcon = Label(master, image=self.catIconImage)
        self.catIcon.pack(side=TOP)
        label = Label(master, text=GatoDialogs.crnotice1)
        label.pack(side=TOP)
        label = Label(master, font="Helvetica 10", 
                      text=GatoDialogs.crnotice2, justify=CENTER)
        label.pack(side=TOP)
        color = self.config("bg")[4]
        self.infoText = ScrolledText(master, relief=FLAT, 
                                     padx=3, pady=3,
                                     background=color, 
                                     #foreground="black",
                                     wrap='word',
                                     width=60, height=12,
                                     font="Times 10")
        self.infoText.pack(expand=0, fill=X, side=BOTTOM)
        self.infoText.delete('0.0', END)
        self.infoText.insert('0.0', GatoGlobals.gLGPLText)	
        self.infoText.configure(state=DISABLED)
        self.title("Gred - About")
开发者ID:ProgVal,项目名称:Gato-mirror,代码行数:25,代码来源:ObjectGred.py

示例11: createWidgets

        def createWidgets(self):
                allframe = Frame(root, width=800, height =480)
                allframe.grid(row=0, column=0, padx=0, pady=0, sticky=N+S)
                
                backgroundFile = "rpi.jpg"
                bckImage = Image.open(backgroundFile)
                bckImage = bckImage.resize((self.width, self.height), resample=3)
                background = ImageTk.PhotoImage(bckImage)
                bckPanel = Label(allframe, image=background)
                bckPanel.grid(row=0, column=0, padx=0, pady=0, sticky=W)
                bckPanel.image = background

                openkeyBtn = Button(root, text="KeyBoard", command=self.openkey, bg="white") #create a button inside the btnFrame with the given features
                openkeyBtn.place(x=5,y=320)

                CameraBtn = Button(root, text="Camera", command=self.opencamera, bg="white")
                CameraBtn.place(x=280,y=320)

                startchatBtn = Button(root, text="Start chat", command=self.startchat, bg="white") #create a button inside the btnFrame with the given features
                startchatBtn.place(x=95,y=320)

                stopcameraBtn = Button(root, text="stop camera", command=self.closecamera, bg="white") #create a button inside the btnFrame with the given features
                stopcameraBtn.place(x=365,y=320)

                stopchatBtn = Button(root, text="Stop chat", command=self.stopchat, bg="white") #create a button inside the btnFrame with the given features
                stopchatBtn.place(x=190,y=320)

                self.chatLog = ScrolledText(root, width = 115, height = 20, takefocus=0, highlightthickness=1, highlightbackground="#333")
                self.chatLog.place(x=5, y=350)
                
                self.temperature = Label(root, textvariable=self.temp_data, bg="white", font=('Verdana', 15, 'bold'))
                self.temp_data.set("Temperature")
                self.temperature.place(x=80, y=0)

                self.tempLog = ScrolledText(root, width = 35, height = 20, takefocus=0, highlightthickness=1, highlightbackground="#333")
                self.tempLog.place(x=5, y=25)

                self.preasureLog = ScrolledText(root, width = 35, height = 20, takefocus=0, highlightthickness=1, highlightbackground="#333")
                self.preasureLog.place(x=285, y=25)

                self.heartLog = ScrolledText(root, width = 35, height = 20, takefocus=0, highlightthickness=1, highlightbackground="#333")
                self.heartLog.place(x=560, y=25)
                
                self.preasure = Label(root, textvariable=self.preasure_data, bg="white", font=('Verdana', 15, 'bold'))
                self.preasure_data.set("Preasure")
                self.preasure.place(x=370, y=0)

                self.heart_rate = Label(root, textvariable=self.heart_rate_data, bg="white", font=('Verdana', 15, 'bold'))
                self.heart_rate_data.set("Heart rate")
                self.heart_rate.place(x=630, y=0)
开发者ID:Orionteamnsac,项目名称:Orion-s-Wearable-Device-,代码行数:50,代码来源:final.py

示例12: __init__

	def __init__(self, parent, app):
		Frame.__init__(self, parent)
		self.parent = parent
		self.app = app

		#Frame to hold Keyword Group new Entry and new keywords text box
		addKGFrame = Frame(parent, bg="#E8E8E8", relief=RAISED)
		addKGFrame.pack(fill=BOTH, expand=True, side=LEFT, padx=10, pady=10)

		#Label for Entry Box
		addGroupLabel = Label(addKGFrame, text="Enter New Group Name",bg="#E8E8E8")
		addGroupLabel.pack(side=TOP)

		#Entry Box for new Keyword Group
		self.addGroup = Entry(addKGFrame, width=30, relief=SUNKEN)
		self.addGroup.pack(side=TOP, fill=X, expand=True, pady=5)

		#Label for New Keywords for Group Text Box
		addKGLabel = Label(addKGFrame, text="Enter New Keywords (Optional)",bg="#E8E8E8")
		addKGLabel.pack(side=TOP, fill=X, expand=True, pady=5)

		#Canvas for Text Box to Enter New Keywords for New Group
		addKGCanvas = Canvas(addKGFrame, bg="#E8E8E8", relief=SUNKEN)
		addKGCanvas.pack(side=TOP, fill=BOTH, expand=True, pady=5)

		#Keywords for new group scrollable text box
		self.addKGText = ScrolledText(addKGCanvas, wrap=WORD, width=25, 
			height=15, relief=SUNKEN, highlightthickness=0, bd=1, padx=1, pady=1)
		self.addKGText.pack(fill=BOTH, side=TOP, expand=True)

		#Button to add new Keyword Group and Keywords
		addKGButton = Button(addKGFrame, text="Add Group", 
			width=30, highlightbackground='#E8E8E8', command=self.group_add)
		addKGButton.pack(side=TOP, fill=BOTH, expand=True)
开发者ID:Cmiller9,项目名称:KW_GRPR,代码行数:34,代码来源:KwGui.py

示例13: make_editAria

    def make_editAria(self, parent):
        self.text = ScrolledText( parent )
        self.text.pack(side=TOP, fill=BOTH)

        def updateTitle(evt):
            '''実験コード。まだ
            改行や行末改行の削除に弱いです
            '''
#            print self.text.index('1.end')
#            print self.text.index(INSERT)

            if self.text.index(INSERT).split('.')[0] == '1': # 1行目
                itemnum = self.memos.getSelectedIndex()

                self.memoList.delete(itemnum)
                self.memoList.insert(itemnum,
                             "%s | %s" % (self.memos[itemnum].getDatetime().strftime("%Y-%m-%d %H:%M"),
                                          u'%s%s%s' % ( self.text.get('1.0', INSERT), 
                                                        evt.char.decode('utf_8'),
                                                        self.text.get(INSERT, '1.end'))))
                self.memoList.selection_clear(0,END)
                self.memoList.selection_set(itemnum)
                self.memoList.see(itemnum)


        self.text.bind('<Key>', updateTitle )

        def ime_ctrl_m(evt):
            if evt.keycode == 0:
                self.text.insert( INSERT, evt.char )
        self.text.bind('<Control-Key>',ime_ctrl_m)
开发者ID:minekoa,项目名称:memopad,代码行数:31,代码来源:memopad.py

示例14: __init__

    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.master.title("Network Simulator Log")
        self.text = ScrolledText(self)
        self.text.pack(fill=BOTH, expand=1)
        self.pack(fill=BOTH, expand=1)
        self.text.config(
            background="black",
            foreground="white",
            font=Font(
                family="Courier", weight="bold"),
            # state=DISABLED,
            wrap=NONE, )

        self.text.tag_config("DEBUG", foreground="green")
        self.text.tag_config("ERROR", foreground="red")
        self.text.tag_config("CRITICAL", foreground="red")
        self.text.tag_config("EXCEPTION", foreground="red")
        self.text.tag_config("WARNING", foreground="yellow")
        self.text.tag_config("INFO", foreground="white")

        self.text.bind("<Key>", lambda e: 'break')
        self.text.bind("<Return>", self._clear)
        self.queue = Queue()
        self._update()
开发者ID:VladJamir,项目名称:cmsc135,代码行数:25,代码来源:logviewer.py

示例15: __init__

  def __init__(self, master):
    Thread.__init__(self)
    frame = Frame(master)
    frame.pack()

    gframe = Frame(frame)
    gframe.pack(anchor='w')
    self.lblserver = Label(gframe, text="IP Server :")
    self.txtserver =  Entry(gframe,width=40)
    self.lblserver.pack(side=LEFT)
    self.txtserver.pack(side=LEFT)
    self.lblport = Label(gframe, text="Port :")
    self.txtport =  Entry(gframe,width=40)
    self.lblport.pack(side=LEFT)
    self.txtport.pack(side=LEFT)
    self.koneksi = Button(gframe, text='Listen', command=self.Listen).pack(side=LEFT)
    
    self.gettext = ScrolledText(frame, height=10,width=100, state=NORMAL)
    self.gettext.pack()
    sframe = Frame(frame)
    
    sframe.pack(anchor='w')
    self.pro = Label(sframe, text="Server>>")
    self.sendtext = Entry(sframe,width=80)
    self.sendtext.focus_set()
    self.sendtext.bind(sequence="<Return>", func=self.Send)
    self.pro.pack(side=LEFT)
    self.sendtext.pack(side=LEFT)
    self.gettext.configure(state=DISABLED)
开发者ID:harissaint,项目名称:Tugas-OOP2,代码行数:29,代码来源:server.py


注:本文中的ScrolledText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。