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


Python scrolledtext.ScrolledText方法代碼示例

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


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

示例1: createWidgets

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def createWidgets(self):    
        tabControl = ttk.Notebook(self.win)     
        tab1 = ttk.Frame(tabControl)            
        tabControl.add(tab1, text='Tab 1')    
        tabControl.pack(expand=1, fill="both")  
        self.monty = ttk.LabelFrame(tab1, text=' Monty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        

        scr = scrolledtext.ScrolledText(self.monty, width=30, height=3, wrap=tk.WORD)
        scr.grid(column=0, row=3, sticky='WE', columnspan=3)

        menuBar = Menu(tab1)
        self.win.config(menu=menuBar)
        fileMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="File", menu=fileMenu)
        helpMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="Help", menu=helpMenu)
        
        self.createButtons() 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Third-Edition,代碼行數:21,代碼來源:GUI_DesignPattern.py

示例2: __init__

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def __init__(self, frame):
        self.frame = frame
        # Create a ScrolledText wdiget
        self.scrolled_text = ScrolledText(frame, state='disabled', height=12)
        self.scrolled_text.grid(row=0, column=0, sticky=(N, S, W, E))
        self.scrolled_text.configure(font='TkFixedFont')
        self.scrolled_text.tag_config('INFO', foreground='black')
        self.scrolled_text.tag_config('DEBUG', foreground='gray')
        self.scrolled_text.tag_config('WARNING', foreground='orange')
        self.scrolled_text.tag_config('ERROR', foreground='red')
        self.scrolled_text.tag_config('CRITICAL', foreground='red', underline=1)
        # Create a logging handler using a queue
        self.log_queue = queue.Queue()
        self.queue_handler = QueueHandler(self.log_queue)
        formatter = logging.Formatter('%(asctime)s: %(message)s')
        self.queue_handler.setFormatter(formatter)
        logger.addHandler(self.queue_handler)
        # Start polling messages from the queue
        self.frame.after(100, self.poll_log_queue) 
開發者ID:beenje,項目名稱:tkinter-logging-text-widget,代碼行數:21,代碼來源:main.py

示例3: __init__

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def __init__(self, parent, isRunning):
        super().__init__(parent)
        self.parent = parent
        self.pack()
        self.state = DayState()
        self.isRunning = isRunning

        self.textClock = tkinter.Label(self, width=60, text="現在時間是00:00", anchor=tkinter.W)
        self.textScreen = ScrolledText(self, height=10, width=60, state="disable")
        self.buttonUse = tkinter.Button(self, text="使用金庫")
        self.buttonAlarm = tkinter.Button(self, text="按下警鈴")
        self.buttonPhone = tkinter.Button(self, text="正常通話")
        self.buttonExit = tkinter.Button(self, text="結束", command=self.quit)

        self.textClock.grid(row=0, columnspan=6, padx=2, pady=2, sticky=tkinter.EW)
        self.textScreen.grid(row=1, columnspan=6, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonUse.grid(row=2, column=1, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonAlarm.grid(row=2, column=2, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonPhone.grid(row=2, column=3, padx=2, pady=2, sticky=tkinter.EW)
        self.buttonExit.grid(row=2, column=4, padx=2, pady=2, sticky=tkinter.EW)

        self.buttonUse.bind("<Button-1>", self.useEvent)
        self.buttonAlarm.bind("<Button-1>", self.useAlarm)
        self.buttonPhone.bind("<Button-1>", self.usePhone) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:26,代碼來源:SafeFrame.py

示例4: initialize

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.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

示例5: initWidgets

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def initWidgets(self):
        self.app = tk.Tk()  # 根窗口的實例(root窗口)
        self.app.geometry('600x200')
        self.app.resizable(0, 0)  # 阻止Python GUI的大小調整
        frame1 = Frame(self.app, padx=20)
        frame1.pack(side=LEFT, fill=BOTH)
        t1 = tk.Label(frame1, text='護肝腳本', font=("華文行楷", 22), borderwidth=2).pack(side=TOP, fill=X, expand=YES)

        frame2 = Frame(self.app)
        t1 = tk.Label(frame2, text='日誌', borderwidth=2, font=('微軟雅黑', 10), height=1).pack(side=TOP, fill=X, expand=YES)
        t3 = scrolledtext.ScrolledText(frame2, font=('微軟雅黑', 10))
        t3.pack(side=TOP, fill=X, expand=YES)
        frame2.pack(side=RIGHT, fill=BOTH, expand=YES)
        Button(frame1, command=lambda: YuhunTwo(t3, NeedCloseGame, NeedCloseSystem), text='自動禦魂副本', width=20).pack(
            side=TOP, expand=YES)
        Checkbutton(frame1, text='體力用完自動關閉遊戲', command=ChangeEndActionWithGame).pack(side=TOP, anchor='w')
        Checkbutton(frame1, text='體力用完自動關機', command=ChangeEndActionWithSystem).pack(side=TOP, anchor='w')
        Button(frame1, command=lambda: StopAll(t3), text='停止', width=20).pack(side=TOP, expand=YES)

        self.app.protocol("WM_DELETE_WINDOW", lambda: Closing(self.app))
        Window.LogUI = t3
        self.app.bind("<Key>", ShortCut)
        self.app.mainloop()  # 窗口的主事件循環,必須的。 
開發者ID:li-zheng-hao,項目名稱:yysScript,代碼行數:25,代碼來源:Window.py

示例6: user

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def user(self):  # 用戶信息
        User = tk.LabelFrame(self.window, text="關鍵字任務", padx=10, pady=5)  # 水平,垂直方向上的邊距均為 10
        User.place(x=30, y=100)
        self.userListBox = Listbox(User, width=50, height=9, )
        self.userListBox.pack(side=LEFT)
        userScroBar = Scrollbar(User)
        userScroBar.pack(side=RIGHT, fill=Y)

        self.userListBox['yscrollcommand'] = userScroBar.set
        self.insert_userListbox()
        userScroBar['command'] = self.userListBox.yview
        # userScrotext = scrolledtext.ScrolledText(User, width=30, height=6, padx=10, pady=10, wrap=tk.WORD)
        # userScrotext.grid(columnspan=2, pady=10)
        Useroption = tk.LabelFrame(self.window, text="", padx=10, pady=5)  # 水平,垂直方向上的邊距均為 10
        Useroption.place(x=30, y=300)
        tk.Button(Useroption, text="添加關鍵字", command=self.add_user).grid(column=0, row=1, padx=57, pady=5)
        tk.Button(Useroption, text="刪除關鍵字", command=self.delete_use).grid(column=1, row=1, padx=57, pady=5)
        tk.Button(Useroption, text="一鍵開啟", command=self.all_start).grid(column=0, row=3, padx=55, pady=5)
        tk.Button(Useroption, text="一鍵關閉", command=self.all_stop).grid(column=1, row=3, padx=55, pady=5)
        self.startBtn = tk.Button(Useroption, text="單項開啟", command=self.start_spider)
        self.startBtn.grid(column=0, row=2, padx=55, pady=5)
        self.stopBtn = tk.Button(Useroption, text="單項關閉", command=self.stop_spider)
        self.stopBtn.grid(column=1, row=2, padx=55, pady=5) 
開發者ID:Hatcat123,項目名稱:XianyuSdd,代碼行數:25,代碼來源:tkXianYu.py

示例7: _init_gui

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def _init_gui(self):
        self.window = tk.Tk()
        self.window.geometry('800x400')
        self.window.title('Launcher')
        frame_top = tk.Frame(bd=1, relief=tk.RIDGE)
        frame_bottom = tk.Frame(bd=1, relief=tk.RIDGE)
        self.dropdown = ttk.Combobox(frame_top, values=glob.glob('*.yaml'))
        self.dropdown.current(0)
        self.button_start = tk.Button(frame_top, text='Start', fg='green')
        self.button_stop = tk.Button(frame_top, text='Stop', fg='red', state=tk.DISABLED)
        self.output = scrolledtext.ScrolledText(frame_bottom)
        frame_top.pack(fill=tk.BOTH, padx=5, pady=5)
        frame_bottom.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)
        self.dropdown.pack(padx=5, pady=5, fill=tk.X, side=tk.LEFT)
        self.button_start.pack(padx=5, pady=5, side=tk.LEFT)
        self.button_stop.pack(padx=5, pady=5, side=tk.LEFT)
        self.output.pack(fill=tk.BOTH, expand=True)
        self.button_start.bind('<Button-1>', self._on_start)
        self.button_stop.bind('<Button-1>', self._on_stop)
        self.window.protocol('WM_DELETE_WINDOW', self._on_closing) 
開發者ID:timeflux,項目名稱:timeflux,代碼行數:22,代碼來源:launcher.py

示例8: log

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def log(self):  # 日誌
        self.logMessage.put('歡迎使用【閑魚信息采集器】')
        logInformation = tk.LabelFrame(self.window, text="日誌", padx=10, pady=10)  # 水平,垂直方向上的邊距均為10
        logInformation.place(x=450, y=100)
        self.logInformation_Window = scrolledtext.ScrolledText(logInformation, width=77, height=22, padx=10, pady=10,
                                                               wrap=tk.WORD)
        self.logInformation_Window.grid() 
開發者ID:Hatcat123,項目名稱:XianyuSdd,代碼行數:9,代碼來源:tkXianYu.py

示例9: menu_bar_show_logs_command

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def menu_bar_show_logs_command():
    """
    Show logs menu button click handler
    """
    global logs_window
    global logs_text
    # If there is another show logs window open
    if logs_window:
        # Bring the window to front
        logs_window.lift()

        return
    # Logs window
    logs_window = tkinter.Toplevel(main_window)
    logs_window.title("Logs")
    logs_window.geometry('680x252')
    logs_window.lift()
    # ScrolledText widget
    logs_text = scrolledtext.ScrolledText(logs_window, state=tkinter.DISABLED)
    logs_text.pack(fill=tkinter.BOTH, expand=True)
    # Load logs to text widget
    update_logs_text_if_visible()

    def on_close():
        """
        Logs window 'on close' handler
        """
        global logs_text
        global logs_window

        logs_text = None
        logs_window.destroy()
        logs_window = None

    logs_window.protocol('WM_DELETE_WINDOW', on_close)
    # Show the window
    logs_window.mainloop() 
開發者ID:mahdavipanah,項目名稱:pynpuzzle,代碼行數:39,代碼來源:pynpuzzle.py

示例10: createWidgets

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def createWidgets():    
    tabControl = ttk.Notebook(win)     
    tab1 = ttk.Frame(tabControl)            
    tabControl.add(tab1, text='Tab 1')    
    tabControl.pack(expand=1, fill="both")  
    monty = ttk.LabelFrame(tab1, text=' Mighty Python ')
    monty.grid(column=0, row=0, padx=8, pady=4)        
    
    ttk.Label(monty, text="Enter a name:").grid(column=0, row=0, sticky='W')
    name = tk.StringVar()
    nameEntered = ttk.Entry(monty, width=12, textvariable=name)
    nameEntered.grid(column=0, row=1, sticky='W')
    
    action = ttk.Button(monty, text="Click Me!")   
    action.grid(column=2, row=1)
    
    ttk.Label(monty, text="Choose a number:").grid(column=1, row=0)
    number = tk.StringVar()
    numberChosen = ttk.Combobox(monty, width=12, textvariable=number)
    numberChosen['values'] = (42)
    numberChosen.grid(column=1, row=1)
    numberChosen.current(0)
    
    scrolW = 30; scrolH = 3
    scr = scrolledtext.ScrolledText(monty, width=scrolW, height=scrolH, wrap=tk.WORD)
    scr.grid(column=0, row=3, sticky='WE', columnspan=3)
    
    menuBar = Menu(tab1)
    win.config(menu=menuBar)
    fileMenu = Menu(menuBar, tearoff=0)
    menuBar.add_cascade(label="File", menu=fileMenu)
    helpMenu = Menu(menuBar, tearoff=0)
    menuBar.add_cascade(label="Help", menu=helpMenu)
    
    nameEntered.focus()     
#====================== 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:38,代碼來源:GUI_Not_OOP.py

示例11: createWidgets

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def createWidgets(self):    
        tabControl = ttk.Notebook(self.win)     
        tab1 = ttk.Frame(tabControl)            
        tabControl.add(tab1, text='Tab 1')    
        tabControl.pack(expand=1, fill="both")  
        self.monty = ttk.LabelFrame(tab1, text=' Mighty Python ')
        self.monty.grid(column=0, row=0, padx=8, pady=4)        
        
        ttk.Label(self.monty, text="Enter a name:").grid(column=0, row=0, sticky='W')
        self.name = tk.StringVar()
        nameEntered = ttk.Entry(self.monty, width=12, textvariable=self.name)
        nameEntered.grid(column=0, row=1, sticky='W')

        self.action = ttk.Button(self.monty, text="Click Me!")   
        self.action.grid(column=2, row=1)
        
        ttk.Label(self.monty, text="Choose a number:").grid(column=1, row=0)
        number = tk.StringVar()
        numberChosen = ttk.Combobox(self.monty, width=12, textvariable=number)
        numberChosen['values'] = (42)
        numberChosen.grid(column=1, row=1)
        numberChosen.current(0)
   
        scrolW = 30; scrolH = 3
        self.scr = scrolledtext.ScrolledText(self.monty, width=scrolW, height=scrolH, wrap=tk.WORD)
        self.scr.grid(column=0, row=3, sticky='WE', columnspan=3)

        menuBar = Menu(tab1)
        self.win.config(menu=menuBar)
        fileMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="File", menu=fileMenu)
        helpMenu = Menu(menuBar, tearoff=0)
        menuBar.add_cascade(label="Help", menu=helpMenu)

        nameEntered.focus()     
#========================== 
開發者ID:PacktPublishing,項目名稱:Python-GUI-Programming-Cookbook-Second-Edition,代碼行數:38,代碼來源:GUI_OOP.py

示例12: __init__

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def __init__(self, master, **options):
            tkst.ScrolledText.__init__(self, master, **options)
            self.queue = queue.Queue()
            self.update_me() 
開發者ID:ValdikSS,項目名稱:blockcheck,代碼行數:6,代碼來源:blockcheck.py

示例13: __init__

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def __init__(self, window):
        self.window = window
        self.window.title('Google Translate')

        frm = tk.Frame(self.window)
        frm.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)

        frm_input = tk.Frame(frm)
        frm_output = tk.Frame(frm)
        frm_input.pack(anchor=tk.NW, fill=tk.X)
        frm_output.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)

        self.input_text = tk.StringVar()
        self.input_entry = ttk.Entry(frm_input, textvariable=self.input_text)
        self.input_entry.pack(side=tk.LEFT, fill=tk.X, expand=1)

        self.run_queue = Queue()
        self.trans_button = ttk.Button(frm_input, text='trans', width=6, command=self.run)
        self.trans_button.pack(anchor=tk.NE, side=tk.LEFT)

        self.st = scrolledtext.ScrolledText(frm_output, state=tk.NORMAL)
        self.st.insert(tk.END, 'Google Translate\n')
        self.st.pack(anchor=tk.NW, fill=tk.BOTH, expand=1)

        self.input_entry.bind('<Return>', self.run)
        self.input_entry.bind('<Escape>', lambda event=None: self.input_text.set('')) 
開發者ID:xinebf,項目名稱:google-translate-for-goldendict,代碼行數:28,代碼來源:googletranslateui.py

示例14: add_new_clip

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.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

示例15: __tab1_content

# 需要導入模塊: from tkinter import scrolledtext [as 別名]
# 或者: from tkinter.scrolledtext import ScrolledText [as 別名]
def __tab1_content(self, tab_name):
        dir_section = tk.LabelFrame(tab_name, text='請輸入目錄信息', background=self.__BG_GREY, font=self.__FONT)
        dir_section.place(x=10, y=10, width=880, height=480)

        tk.Label(dir_section, text='待整理路徑:', background=self.__BG_GREY,
                 font=self.__FONT).place(x=2, y=10, width=110, height=30)
        prepare_label = tk.Label(dir_section, background=self.__WHITE, relief='solid', anchor='w',
                                 borderwidth=1, font=self.__FONT)
        prepare_label.place(x=112, y=10, width=600, height=30)
        tk.Button(dir_section, text='選擇輸入路徑', justify=tk.CENTER, font=self.__FONT,
                  command=lambda: self.__get_path(prepare_label)).place(x=720, y=10, width=150, height=30)

        tk.Label(dir_section, text='輸出文件夾:', background=self.__BG_GREY,
                 font=self.__FONT).place(x=2, y=60, width=110, height=30)
        output_label = tk.Label(dir_section, background=self.__WHITE, relief='solid', anchor='nw',
                                borderwidth=1, font=self.__FONT)
        output_label.place(x=112, y=60, width=600, height=30)
        tk.Button(dir_section, text='選擇輸出路徑', justify=tk.CENTER, font=self.__FONT,
                  command=lambda: self.__get_path(output_label)).place(x=720, y=60, width=150, height=30)

        tk.Button(dir_section, text='開始整理', justify=tk.CENTER, font=self.__FONT,
                  command=lambda: self.__start_running(prepare_label['text'],
                                                       output_label['text'])).place(x=10, y=110, width=150, height=30)

        attention = '請務必確認路徑選擇正確,不然可能會造成數據丟失的嚴重後果!!!'
        tk.Label(dir_section, text=attention, background=self.__BG_GREY, font=("Microsoft YaHei", 10),
                 anchor='w', foreground="#222222", ).place(x=180, y=110, width=500, height=30)

        tk.Label(dir_section, text='信息和日誌:', background=self.__BG_GREY, font=self.__FONT,
                 justify=tk.RIGHT).place(x=2, y=160, width=110, height=30)

        info = scrolledtext.ScrolledText(dir_section)
        info.place(x=10, y=200, width=860, height=250)
        info.insert(tk.INSERT, "Some text")
        info.insert(tk.INSERT, "asfasdfsadfsadfsadfsadf")
        info.insert(tk.INSERT, "Some text\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
        info.insert(tk.END, " in ScrolledText")
        info.config(state=tk.DISABLED) 
開發者ID:tywings,項目名稱:JAVER_Assist,代碼行數:40,代碼來源:main_gui.py


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