當前位置: 首頁>>代碼示例>>Python>>正文


Python ScrolledText.ScrolledText方法代碼示例

本文整理匯總了Python中ScrolledText.ScrolledText方法的典型用法代碼示例。如果您正苦於以下問題:Python ScrolledText.ScrolledText方法的具體用法?Python ScrolledText.ScrolledText怎麽用?Python ScrolledText.ScrolledText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ScrolledText的用法示例。


在下文中一共展示了ScrolledText.ScrolledText方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: initialize

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def initialize(self):
        """
        Set window layout.
        """
        self.grid()

        self.respond = ttk.Button(self, text='Get Response', command=self.get_response)
        self.respond.grid(column=0, row=0, sticky='nesw', padx=3, pady=3)

        self.usr_input = ttk.Entry(self, state='normal')
        self.usr_input.grid(column=1, row=0, sticky='nesw', padx=3, pady=3)

        self.conversation_lbl = ttk.Label(self, anchor=tk.E, text='Conversation:')
        self.conversation_lbl.grid(column=0, row=1, sticky='nesw', padx=3, pady=3)

        self.conversation = ScrolledText.ScrolledText(self, state='disabled')
        self.conversation.grid(column=0, row=2, columnspan=2, sticky='nesw', padx=3, pady=3) 
開發者ID:gunthercox,項目名稱:ChatterBot,代碼行數:19,代碼來源:tkinter_gui.py

示例2: add_listener

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def add_listener(self, taskno):
        "There is a ScrolledText for each task"
        st = ScrolledText(self.root, height=5)
        st.insert('end', 'Output of task %d\n' % taskno)
        st.pack()
        self.widgets[taskno] = st 
開發者ID:micheles,項目名稱:plac,代碼行數:8,代碼來源:plac_tk.py

示例3: add_new_clip

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def add_new_clip(self):
        '''
         destroy frames and add with new clip added
        '''
        for frame in self.frames:
            frame.destroy()

        self.frames = []
        self.textBoxes = []
        self.no_of_clips = len(utils.clips)

        for clip, i in zip(reversed(utils.clips), range(len(utils.clips))):

            frame = Frame(self.mainFrame, padx=5,
                          pady=5, bg=self.colors[i % 3])

            Button(frame, text="clip it ", font="Helvetica 12 bold",
                   command=partial(self.copy_to_clipboard, i), relief=RAISED,
                   padx=3, pady=3, bg='dark violet', fg='white').grid(
                       row=0, column=0, ipady=2
                   )

            Button(frame, text="delete", font="Helvetica 12 bold",
                   command=partial(self.delete_frame, len(utils.clips)-i-1),
                   relief=RAISED,
                   padx=3, pady=3, bg='red', fg='white').grid(
                       row=1, column=0, ipady=2
                   )

            textBox = ScrolledText(frame, height=4, width=20,
                                   font="Helvetica 12 bold")
            textBox.insert(END, clip)

            textBox.grid(row=0, column=1, rowspan=2, sticky=E, padx=5)
            self.textBoxes.append(textBox)

            self.no_of_clips = len(utils.clips)

            frame.pack(fill='both', expand=True, pady=5)
            self.frames.append(frame) 
開發者ID:nikhilkumarsingh,項目名稱:clix,代碼行數:42,代碼來源:gui.py

示例4: root

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def root(Text):
    global ReturnText
    root = Tkinter.Tk(className="SimplyTemplate Test Editor")
    textPad = ScrolledText.ScrolledText(
        root, width=100, height=15)  # creates text area
    menu = Menu(root)
    root.config(menu=menu)
    filemenu = Menu(menu)
    menu.add_cascade(label="File", menu=filemenu)
    filemenu.add_command(
        label="Save", command=lambda: save_command(textPad, root))
    filemenu.add_separator()
    filemenu.add_command(label="Exit", command=lambda: exit_command(root))
    helpmenu = Menu(menu)
    menu.add_cascade(label="Help", menu=helpmenu)
    helpmenu.add_command(label="About...", command=about_command)
    # end of menu creation
    textPad.pack()
    build(textPad, Text)
    root.mainloop()
    try:
        if ReturnText:
            return ReturnText
    except:
        print " [!] No text returned / changed"
        pass 
開發者ID:SimplySecurity,項目名稱:SimplyTemplate,代碼行數:28,代碼來源:TemplateEdit.py

示例5: create_destroyDebugTracing

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def create_destroyDebugTracing(self, *args):
    	# test creating tracing/debug window
    	
    	if (self.dbgTracing):
    		self.dbgTracing.destroy()
    		self.dbgTracing = None
    		self.debug = False

    	else:
	        try:
	            # have in its own special di decial class
	            self.dbgTracing = Tkinter.Toplevel()
	            self.dbgTracing.title("Tracing/Debug")
	            dbgTraceFrame2 = Tkinter.Frame(self.dbgTracing)
	            dbgTraceFrame2.pack(side='top', fill='x')
	            dbgTraceFrame = Tkinter.Frame(self.dbgTracing)
	            dbgTraceFrame.pack(side='top', fill='x',expand='yes')
	            self.traceWindow = ScrolledText(dbgTraceFrame, background='#f4f4f4',
	                                              foreground='#aa0000', width=45, height=24, wrap='none')
	
	            Tkinter.Button(dbgTraceFrame2, text='clear',
	                           background='#a0c0c0', foreground='black',
	                           command= lambda start=1.0, end=Tkinter.END : self.traceWindow.delete(start,end)
	                           ).pack(side='right')
	            Tkinter.Button(dbgTraceFrame2, text='Save',
	                           background='#a0c0c0', foreground='black',
	                           command= lambda file=self.kimmoResultFile,windowName=self.traceWindow,mode='w',auto=0 : self.writeToFilefromWindow(file,windowName,mode,auto)
	                           ).pack(side='left')
	
	
	            scroll = Tkinter.Scrollbar(dbgTraceFrame, orient='horizontal',command=self.traceWindow.xview)
	            scroll.pack(side='bottom', fill='x')
	
	            self.traceWindow.configure(xscrollcommand = scroll.set)
	            self.traceWindow.pack(side='bottom')
	
	
	            self.debug = True
	
	            # this will automatically clean itself up.
	            self.dbgTracing.protocol("WM_DELETE_WINDOW", self.create_destroyDebugTracing)
	
	        except:
	            print 'Error creating Tree View'
	            self.dbgTracing.destroy()
	            self.dbgTracing = None
	            self.debug = False
	            raise 
開發者ID:rafasashi,項目名稱:razzy-spinner,代碼行數:50,代碼來源:kimmo.py

示例6: __init__

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def __init__(self):
        root = tk.Tk()
        root.title('OpenCV Demo')

        self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
        self.win.pack(fill=tk.BOTH, expand=1)

        left = tk.Frame(win)
        right = tk.Frame(win)
        win.add(left)
        win.add(right)

        scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
        self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
        scrollbar.config(command=demos_lb.yview)
        scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self.samples = {}
        for fn in glob('*.py'):
            name = splitfn(fn)[1]
            if fn[0] != '_' and name not in exclude_list:
                demos_lb.insert(tk.END, name)
                self.samples[name] = fn
        demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)

        self.cmd_entry = cmd_entry = tk.Entry(right)
        cmd_entry.bind('<Return>', self.on_run)
        run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)

        self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
        self.linker = linker = LinkManager(text, self.on_link)
        self.text.tag_config("header1", font=('arial', 14, 'bold'))
        self.text.tag_config("header2", font=('arial', 12, 'bold'))
        text.config(state='disabled')

        text.pack(fill='both', expand=1, side=tk.BOTTOM)
        cmd_entry.pack(fill='x', side='left' , expand=1)
        run_btn.pack() 
開發者ID:fatcloud,項目名稱:PyCV-time,代碼行數:41,代碼來源:demo.py

示例7: __init__

# 需要導入模塊: import ScrolledText [as 別名]
# 或者: from ScrolledText import ScrolledText [as 別名]
def __init__(self):
        root = tk.Tk()
        root.title('OpenCV Demo')

        self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
        self.win.pack(fill=tk.BOTH, expand=1)

        left = tk.Frame(win)
        right = tk.Frame(win)
        win.add(left)
        win.add(right)

        scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
        self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
        scrollbar.config(command=demos_lb.yview)
        scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
        demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)

        self.samples = {}
        for fn in glob('*.py'):
            name = splitfn(fn)[1]
            if fn[0] != '_' and name not in exclude_list:
                self.samples[name] = fn

        for name in sorted(self.samples):
            demos_lb.insert(tk.END, name)

        demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)

        self.cmd_entry = cmd_entry = tk.Entry(right)
        cmd_entry.bind('<Return>', self.on_run)
        run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)

        self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
        self.linker = linker = LinkManager(text, self.on_link)
        self.text.tag_config("header1", font=('arial', 14, 'bold'))
        self.text.tag_config("header2", font=('arial', 12, 'bold'))
        text.config(state='disabled')

        text.pack(fill='both', expand=1, side=tk.BOTTOM)
        cmd_entry.pack(fill='x', side='left' , expand=1)
        run_btn.pack() 
開發者ID:makelove,項目名稱:OpenCV-Python-Tutorial,代碼行數:44,代碼來源:demo.py


注:本文中的ScrolledText.ScrolledText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。