当前位置: 首页>>代码示例>>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;未经允许,请勿转载。