Python tkinter.ttk 模块,Scrollbar() 实例源码

我们从Python开源项目中,提取了以下38个代码示例,用于说明如何使用tkinter.ttk.Scrollbar()

项目:qcri    作者:douville    | 项目源码 | 文件源码
def __init__(self, master, on_selected=None, **kwargs):
        tk.Frame.__init__(self, master, **kwargs)
        self._cache = {}
        self.tree = ttk.Treeview(self)
        self.tree['show'] = 'headings'
        self.tree['columns'] = ('subject', 'tests', 'status', 'bug')
        self.tree.heading('subject', text='Subject')
        self.tree.heading('tests', text='Test')
        self.tree.heading('status', text='Status')
        self.tree.heading('bug', text='Bug')
        self.tree.column('subject', width=60)
        self.tree.column('tests', width=150)
        self.tree.column('status', width=40)
        self.tree.column('bug', width=10)
        self.tree.bind('<<TreeviewSelect>>', on_selected)
        ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview)
        self.tree.grid(row=0, column=0, sticky='nsew')
        ysb.grid(row=0, column=1, sticky='ns')
        self.tree.configure(yscroll=ysb.set)
项目:python-tagger    作者:Bilingual-Annotation-Task-Force    | 项目源码 | 文件源码
def _create_widgets(self):
        # Gold standard data
        self.gold_path_label = ttk.Label(text="Gold Standard:")
        self.gold_path_entry = ttk.Entry(textvariable=self.gold_path)
        self.gold_path_filebutton = ttk.Button(text="...", command=self.findgoldfile)
        # Training data for language 1
        self.lang1_train_path_label = ttk.Label(text="Language 1 Training Data:")
        self.lang1_train_path_entry = ttk.Entry(textvariable=self.lang1_train_path)
        self.lang1_train_path_filebutton = ttk.Button(text="...", command=self.findlang1trainfile)
        # Training data for language 2
        self.lang2_train_path_label = ttk.Label(text="Language 2 Training Data:")
        self.lang2_train_path_entry = ttk.Entry(textvariable=self.lang2_train_path)
        self.lang2_train_path_filebutton = ttk.Button(text="...", command=self.findlang2trainfile)
        # Examination
        self.examine_button = ttk.Button(text="Examine!", command=self.launch_main)
        # Redirected ouput
        self.output_frame = ttk.Frame()
        self.output = tk.Text(master=self.output_frame)
        self.output_scroll = ttk.Scrollbar(self.output_frame)
        self.output.configure(yscrollcommand=self.output_scroll.set)
        self.output_scroll.configure(command=self.output.yview)

        self.redirected = Redirector(self.output)
项目:synthesizer    作者:irmen    | 项目源码 | 文件源码
def __init__(self, app, master):
        super().__init__(master, text="Playlist", padding=4)
        self.app = app
        bf = ttk.Frame(self)
        ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
        ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
        ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
        ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
        bf.pack(side=tk.LEFT, padx=4)
        sf = ttk.Frame(self)
        cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 60)]
        self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
        self.listTree.configure(yscrollcommand=vsb.set)
        self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.listTree.heading(col, text=col.title())
            self.listTree.column(col, width=colwidth)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, master, factor = 0.5, **kwargs):
        self.__scrollableWidgets = []

        if 'orient' in kwargs:
            if kwargs['orient']== tk.VERTICAL:
                self.__orientLabel = 'y'
            elif kwargs['orient']== tk.HORIZONTAL:
                self.__orientLabel = 'x'
            else:
                raise Exception("Bad 'orient' argument in scrollbar.")
        else:
            self.__orientLabel = 'y'

        kwargs['command'] = self.onScroll
        self.factor = factor

        ttk.Scrollbar.__init__(self, master, **kwargs)
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, **kwargs):
        ttk.Frame.__init__(self, parent, **kwargs)
        self.parent = parent
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.widget_tree = ttk.Treeview(self, selectmode="browse", columns=[""])
        self.widget_tree.grid(row=0, column=0, sticky="nesw")

        self.widget_tree.configure(selectmode="browse")
        self.widget_tree.heading("#0", text="Mod Name")
        self.widget_tree.heading("#1", text="Mod Extension")
        self.widget_tree.column("#1", width=100, stretch=False)

        self.scrollbar_horizontal = ttk.Scrollbar(self, orient="horizontal", command=self.widget_tree.xview)
        self.scrollbar_horizontal.grid(row=1, column=0, sticky="we")

        self.scrollbar_vertical = ttk.Scrollbar(self, orient="vertical", command=self.widget_tree.yview)
        self.scrollbar_vertical.grid(row=0, column=1, sticky="ns")

        self.widget_tree.configure(xscrollcommand=self.scrollbar_horizontal.set,
                                   yscrollcommand=self.scrollbar_vertical.set)
项目:sorter    作者:giantas    | 项目源码 | 文件源码
def _create_canvas(self, window):
        # Configure canvas
        canvas = Canvas(window)
        hsb = ttk.Scrollbar(window, orient="h", command=canvas.xview)
        vsb = ttk.Scrollbar(window, orient="v", command=canvas.yview)
        canvas.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)

        canvas.grid(sticky="nsew")
        hsb.grid(row=1, column=0, stick="ew")
        vsb.grid(row=0, column=1, sticky="ns")

        window.grid_rowconfigure(0, weight=1)
        window.grid_columnconfigure(0, weight=1)

        canvas.configure(scrollregion=(0, 0, 1250, 10000))
        canvas.bind('<Configure>', lambda event,
                    canvas=canvas: self._resize_canvas(event, canvas))
        canvas.bind_all("<Button-4>", lambda event, count=-1,
                        canvas=canvas: self._on_mousewheel(event, canvas, count))
        canvas.bind_all("<Button-5>", lambda event, count=1,
                        canvas=canvas: self._on_mousewheel(event, canvas, count))
        canvas.bind_all("<MouseWheel>", lambda event, count=1,
                        canvas=canvas: self._on_mousewheel(event, canvas, count))

        return canvas
项目:PyTasks    作者:TheHirschfield    | 项目源码 | 文件源码
def eventViewerPlace(self):
        eventViewerFrame = ttk.Frame(self)               
        eventViewerFrame.pack(in_=self, side='top',fill='both', expand='Y')

        self.eventMainView = ttk.Notebook(eventViewerFrame, name='notebook')

        #Event Tab Text Box - Tab 0
        tab0 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab0, text="Tasks")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.eventsBox = Text(tab0, wrap=WORD, width=40, height=10)
        self.eventsBox.pack(fill=BOTH, expand=Y)

        #self.eventsBox.config(state=DISABLED)


        #Note Tab Text Box - Tab 1
        tab1 = ttk.Frame(self.eventMainView)
        self.eventMainView.add(tab1, text="Notes")

        self.eventMainView.pack(fill='both', expand=Y, side='top')

        self.notesBox = Text(tab1, wrap=WORD, width=40, height=10)
        vscroll = ttk.Scrollbar(tab1, orient=VERTICAL, command=self.notesBox.yview)
        self.notesBox['yscroll'] = vscroll.set
        vscroll.pack(side=RIGHT, fill=Y)
        self.notesBox.pack(fill=BOTH, expand=Y)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, master, **kwargs):
        Frame.__init__(self, master)

        textarea_frame = Frame(self, bd=1, relief=SOLID,**kwargs)
        textarea_frame.pack(fill=X)
        textarea_frame.pack_propagate(False)

        self.textarea = Text(textarea_frame, height=1, pady=self.TAG_ENTRY_PADY, padx=self.TAG_ENTRY_PADX, highlightthickness =0, spacing1=0, spacing2=0, spacing3=0, borderwidth=0, wrap="none")
        self.textarea.pack(expand=True, fill=BOTH, padx=2)

        scrollbar = Scrollbar(self, orient=HORIZONTAL, command=self.textarea.xview)
        scrollbar.pack(fill=X)

        self.textarea.configure(xscrollcommand=scrollbar.set)
        self.textarea.bind("<KeyPress>",self._on_keypress)

        tag = Tag(self.textarea, "")
        self.textarea.window_create("1.0", window=tag)
        self.update_idletasks()

        tag_reqheight = tag.winfo_reqheight()
        textarea_frame.configure(height=tag_reqheight + 2*self.TAG_ENTRY_PADY+2*self.textarea["borderwidth"])

        # I add a hidden frame because I want the cursor centered including when there is no tag
        self.textarea.window_create("1.0", window=Frame(self.textarea, height=tag_reqheight, width=0, borderwidth=0))
        tag.destroy()
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def body(self, master):
        text = tk.Text(master, relief="flat", wrap="word", width=0, height=0)
        text.pack(side="left", fill="both", expand=True)
        text.tag_configure("header", justify="center",
                           font=(font.nametofont("TkDefaultFont").cget("family"), 12, "bold"))
        text.tag_configure("hyperlink")

        scrollbar = ttk.Scrollbar(master, orient="vertical", command=text.yview)
        scrollbar.pack(side="right", fill="y")

        text.insert("end", "Libraries:\n", "header")
        text.insert("end", """- Fredrik Lundh for Tkinter.
- Alex Clark for Pillow.
- okdana for jsonesque.
- twoolie for NBT.\n\n""")
        text.insert("end", "Programs:\n", "header")
        text.insert("end", """- MightyPork for ResourcePack Workbench.
- dotPDN, LLC for Paint.NET.
- JetBrains for PyCharm.
- Mojang for Minecraft.\n\n""")
        text.insert("end", "Other:\n", "header")
        text.insert("end", """- Hartmut Goebel, Martin Zibricky, David Cortesi and David Vierra for PyInstaller.
- GitHub for hosting the code.
- Bryan Oakley on StackOverflow for occasional indirect help with code.""")

        text.configure(state="disabled", yscrollcommand=scrollbar.set)
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def body(self, master):
        text = tk.Text(master, relief="flat", wrap="word", width=0, height=0)
        text.pack(side="left", fill="both", expand=True)

        scrollbar = ttk.Scrollbar(master, orient="vertical", command=text.yview)
        scrollbar.pack(side="right", fill="y")

        with open("./LICENSE") as file:
            text.insert(1.0, file.read())

        text.configure(state="disabled", yscrollcommand=scrollbar.set)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scrollbar(self.root, **kwargs)
项目:Craft-Clash    作者:Derpyface-Development-Co    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scrollbar(self.root, **kwargs)
项目:pyfeld    作者:scjurgen    | 项目源码 | 文件源码
def __init__(self, parent):
        Frame.__init__(self, master=parent)
        self.dir_browser = DirBrowseExtended()

        current_row = 0

        self.pathLabel = ttk.Label(text="0/Path")
        self.pathLabel.grid(in_=self, row=current_row, column=0, sticky=EW)
        self.rowconfigure(current_row, weight=0)
        current_row += 1
        self.search_frame = Frame()

        self.search = ttk.Label(master=self.search_frame, text="Search:")
        self.search.pack(side=LEFT, expand=N, fill=NONE)
        self.search = ttk.Entry(master=self.search_frame, text="?")
        self.search.pack(side=LEFT, expand=Y, fill=X)
        self.search_frame.grid(in_=self, row=current_row, column=0, sticky=EW)
        current_row += 1
        self.rowconfigure(current_row, weight=0)

        # create the tree and scrollbars
        self.dataCols = ('title', 'album', 'artist', 'info')
        self.dataColSize = (200, 200, 200, 100)
        self.tree = ttk.Treeview(columns=self.dataCols, show='headings')
        self.tree.bind("<Double-1>", self.OnDoubleClick)
        self.tree.bind("<Button-3>", self.OnRightClick)

        ysb = ttk.Scrollbar(orient=VERTICAL, command=self.tree.yview)
        xsb = ttk.Scrollbar(orient=HORIZONTAL, command=self.tree.xview)
        self.tree['yscroll'] = ysb.set
        self.tree['xscroll'] = xsb.set

        # add tree and scrollbars to frame
        self.tree.grid(in_=self, row=current_row, column=0, sticky=NSEW)
        ysb.grid(in_=self, row=current_row, column=1, sticky=NS)
        xsb.grid(in_=self, row=current_row+1, column=0, sticky=EW)
        # set frame resize priorities
        self.rowconfigure(current_row, weight=1)
        self.columnconfigure(0, weight=1)
        self._init_tree()
        self._load_browse_data()
项目:androidtool    作者:oicebot    | 项目源码 | 文件源码
def __init__(self, master):
        #  Rozen. Added the try-except clauses so that this class
        #  could be used for scrolled entry widget for which vertical
        #  scrolling is not supported. 5/7/14.
        try:
            vsb = ttk.Scrollbar(master, orient='vertical', command=self.yview)
        except:
            pass
        hsb = ttk.Scrollbar(master, orient='horizontal', command=self.xview)

        #self.configure(yscrollcommand=self._autoscroll(vsb),
        #    xscrollcommand=self._autoscroll(hsb))
        try:
            self.configure(yscrollcommand=self._autoscroll(vsb))
        except:
            pass
        self.configure(xscrollcommand=self._autoscroll(hsb))

        self.grid(column=0, row=0, sticky='nsew')
        try:
            vsb.grid(column=1, row=0, sticky='ns')
        except:
            pass
        hsb.grid(column=0, row=1, sticky='ew')

        master.grid_columnconfigure(0, weight=1)
        master.grid_rowconfigure(0, weight=1)

        # Copy geometry methods of master  (taken from ScrolledText.py)
        if py3:
            methods = Pack.__dict__.keys() | Grid.__dict__.keys() \
                  | Place.__dict__.keys()
        else:
            methods = Pack.__dict__.keys() + Grid.__dict__.keys() \
                  + Place.__dict__.keys()

        for meth in methods:
            if meth[0] != '_' and meth not in ('config', 'configure'):
                setattr(self, meth, getattr(master, meth))
项目:Spotilyrics    作者:eitchtee    | 项目源码 | 文件源码
def __init__(self):

        self._errorQueue = []
        self._errorCount = 0
        self._open = 0
        self._firstShowing = 1

        # Create the toplevel window
        self._top = tkinter.Toplevel()
        self._top.protocol('WM_DELETE_WINDOW', self._hide)
        self._top.title('Error in background function')
        self._top.iconname('Background error')

        # Create the text widget and scrollbar in a frame
        upperframe = tkinter.Frame(self._top)

        scrollbar = tkinter.Scrollbar(upperframe, orient='vertical')
        scrollbar.pack(side = 'right', fill = 'y')

        self._text = tkinter.Text(upperframe, yscrollcommand=scrollbar.set)
        self._text.pack(fill = 'both', expand = 1)
        scrollbar.configure(command=self._text.yview)

        # Create the buttons and label in a frame
        lowerframe = tkinter.Frame(self._top)

        ignore = tkinter.Button(lowerframe,
                text = 'Ignore remaining errors', command = self._hide)
        ignore.pack(side='left')

        self._nextError = tkinter.Button(lowerframe,
                text = 'Show next error', command = self._next)
        self._nextError.pack(side='left')

        self._label = tkinter.Label(lowerframe, relief='ridge')
        self._label.pack(side='left', fill='x', expand=1)

        # Pack the lower frame first so that it does not disappear
        # when the window is resized.
        lowerframe.pack(side = 'bottom', fill = 'x')
        upperframe.pack(side = 'bottom', fill = 'both', expand = 1)
项目:Colony    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent):
        self.parent = parent
        self.canvas = self.parent.canvas

        # TODO: Add an easy way for others to make new scenarios without editing code.

        self.scenario_list = []
        self.current_scenarios = 0
        self.selected_scenario = 0

        self.parent.canvas.bind("<Configure>", self.draw_widgets, "+")

        self.canvas.create_text(5, 5, text="Scenarios", anchor="nw", font=colony.get_fonts()["menu"]["title"])

        self.frame_listbox = ttk.Frame(self.parent.canvas)

        self.treeview = ttk.Treeview(self.frame_listbox, show="tree")
        self.treeview.pack(side="left", fill="both", expand=True)
        self.treeview.bind("<<TreeviewSelect>>", self.select_scenario)
        self.treeview.bind("<Double-Button-1>", self.start_game)
        scrollbar_treeview = ttk.Scrollbar(self.frame_listbox, command=self.treeview.yview)
        scrollbar_treeview.pack(side="right", fill="y", expand=True)
        self.treeview.configure(yscrollcommand=scrollbar_treeview.set)

        self.frame_text = ttk.Frame(self.parent.canvas)

        self.text = tk.Text(self.frame_text, wrap="word", width=0, height=12)
        self.text.pack(side="left", fill="both", expand=True)
        scrollbar_text = ttk.Scrollbar(self.frame_text, command=self.text.yview)
        scrollbar_text.pack(side="right", fill="y", expand=False)
        self.text.configure(yscrollcommand=scrollbar_text.set)

        self.game = None

        self.draw_widgets()
        self.default_scenarios()
项目:Zipy    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        self.title("Zipy")
        self.geometry("550x500")
        self.minsize(width=350, height=200)
        self.rowconfigure(1, weight=1)
        self.columnconfigure(0, weight=1)

        self.widget_toolbar = Toolbar(self)
        self.widget_toolbar.grid(row=0, column=0, sticky="we")

        self.widget_statusbar = Statusbar(self)
        self.widget_statusbar.grid(row=2, column=0, sticky="we")

        self.frame_treeview = ttk.Frame(self)
        self.frame_treeview.rowconfigure(0, weight=1)
        self.frame_treeview.columnconfigure(0, weight=1)
        self.frame_treeview.grid(row=1, column=0, sticky="nesw")

        self.widget_treeview = Treeview(self.frame_treeview)
        self.widget_treeview.grid(row=0, column=0, sticky="nesw")
        self.widget_treeview["displaycolumns"] = ("File Extension",
                                                  "Date Modified",
                                                  "File Type",
                                                  "Compress Size",
                                                  "File Size",
                                                  "Filler")
        # print(self.widget_treeview["displaycolumns"])

        self.widget_scrollbar_horizontal = ttk.Scrollbar(self.frame_treeview, orient="horizontal",
                                                         command=self.widget_treeview.xview)
        self.widget_scrollbar_horizontal.grid(row=1, column=0, sticky="we")

        self.widget_scrollbar_vertical = ttk.Scrollbar(self.frame_treeview, orient="vertical",
                                                       command=self.widget_treeview.yview)
        self.widget_scrollbar_vertical.grid(row=0, column=1, sticky="ns")

        self.widget_treeview.configure(xscrollcommand=self.widget_scrollbar_horizontal.set,
                                       yscrollcommand=self.widget_scrollbar_vertical.set)

        self.widget_menu = Menu(self)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scrollbar(self.root, **kwargs)
项目:WiFi_Password_Viewer    作者:jgrigg2017    | 项目源码 | 文件源码
def refresh_results_display(self):
        network_data = Data().network_info
        vert_sb = ttk.Scrollbar(self.mainframe, orient=tk.VERTICAL)
        horz_sb = ttk.Scrollbar(self.mainframe, orient=tk.HORIZONTAL)
        self.results_display = self.multi_column_listbox(ColumnSelect.column_names)
        self.fill_multi_column_listbox(self.results_display, network_data)
        self.results_display.grid(row=0, column=0, in_=self.mainframe,
                                  sticky='NSEW')
        self.results_display.configure(yscrollcommand=vert_sb.set,
                                       xscrollcommand=horz_sb.set)
        vert_sb.grid(row=0, column=1, sticky="NS")
        vert_sb.config(command=self.results_display.yview)
        horz_sb.grid(row=1, column=0, sticky="EW")
        horz_sb.config(command=self.results_display.xview)
        self.results_display['displaycolumns'] = ColumnSelect.columns_shown
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_tk_scrollbar(self, index: int or str="end", *args, **kwargs):
        """Insert a tk.Scrollbar into the game."""
        widget = tk.Scrollbar(self.text, **kwargs)
        self.text.window_create(index, window=widget)

        return widget

        # TK Only
项目:quill    作者:DeflatedPickle    | 项目源码 | 文件源码
def insert_ttk_scrollbar(self, command=None, orient: tk.HORIZONTAL or tk.VERTICAL or str=None, index: int or str="end", *args, **kwargs):
        """Insert a ttk.Scrollbar into the game."""
        widget = ttk.Scrollbar(self.text, command=command, orient=orient, **kwargs)
        self.text.window_create(index, window=widget)

        return widget

        # TTK Only
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def create(self, **kwargs):
        return ttk.Scrollbar(self.root, **kwargs)
项目:synthesizer    作者:irmen    | 项目源码 | 文件源码
def __init__(self, app, master):
        super().__init__(master, text="Search song", padding=4)
        self.app = app
        self.search_text = tk.StringVar()
        self.filter_choice = tk.StringVar(value="title")
        bf = ttk.Frame(self)
        ttk.Label(bf, text="Search for:").pack()
        e = ttk.Entry(bf, textvariable=self.search_text)
        e.bind("<Return>", self.do_search)
        e.bind("<KeyRelease>", self.on_key_up)
        self.search_job = None
        e.pack()
        ttk.Radiobutton(bf, text="title", value="title", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="artist", value="artist", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="album", value="album", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="year", value="year", variable=self.filter_choice, width=10).pack()
        ttk.Radiobutton(bf, text="genre", value="genre", variable=self.filter_choice, width=10).pack()
        ttk.Button(bf, text="Search", command=self.do_search).pack()
        ttk.Button(bf, text="Add all selected", command=self.do_add_selected).pack()
        bf.pack(side=tk.LEFT)
        sf = ttk.Frame(self)
        cols = [("title", 320), ("artist", 200), ("album", 200), ("year", 50), ("genre", 120), ("length", 60)]
        self.resultTreeView = ttk.Treeview(sf, columns=[col for col, _ in cols], height=11, show="headings")
        vsb = ttk.Scrollbar(orient="vertical", command=self.resultTreeView.yview)
        self.resultTreeView.configure(yscrollcommand=vsb.set)
        self.resultTreeView.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
        vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
        for col, colwidth in cols:
            self.resultTreeView.heading(col, text=col.title(), command=lambda c=col: self.sortby(self.resultTreeView, c, 0))
            self.resultTreeView.column(col, width=colwidth)
        self.resultTreeView.bind("<Double-1>", self.on_doubleclick)
        sf.grid_columnconfigure(0, weight=1)
        sf.grid_rowconfigure(0, weight=1)
        sf.pack(side=tk.LEFT, padx=4)
项目:Enhance-GoodReads-Export    作者:PaulKlinger    | 项目源码 | 文件源码
def __init__(self, text_queue: multiprocessing.Queue, *args, **kwargs):
        ttk.Frame.__init__(self, *args, **kwargs)

        self.text = tk.Text(self, height=6, width=100)
        self.vsb = ttk.Scrollbar(self, orient="vertical", command=self.text.yview)
        self.text.configure(yscrollcommand=self.vsb.set)
        self.vsb.pack(side="right", fill="y")
        self.text.pack(side="left", fill="both", expand=True)
        self.queue = text_queue
        self.update()
项目:cookiecutter-py3tkinter    作者:ivanlyon    | 项目源码 | 文件源码
def __init__(self, parent):
        ttk.Frame.__init__(self, parent)
        self.config(border=1, relief=tkinter.GROOVE)

        self.scrollbar = ttk.Scrollbar(self, orient=tkinter.VERTICAL)
        self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y, expand=1)

        self.listbox = tkinter.Listbox(self, bg='white')
        self.listbox.pack(side=tkinter.LEFT, fill=tkinter.BOTH, expand=1)
        for i in range(1, 100):
            self.listbox.insert(tkinter.END, _('Navigation ') + str(i))
        self.listbox.config(yscrollcommand=self.scrollbar.set)
        self.scrollbar.config(command=self.listbox.yview)
        self.bind_all('<<ListboxSelect>>', self.onselect)
        self.pack()
项目:birdbody    作者:magnusnissel    | 项目源码 | 文件源码
def draw_file_management(self):
        #=== File management frame ===#
        self.file_frame.rowconfigure(1, weight=0)
        self.file_frame.rowconfigure(2, weight=0)
        self.file_frame.rowconfigure(3, weight=0)
        self.file_frame.rowconfigure(4, weight=0)
        self.file_frame.rowconfigure(5, weight=0)
        self.file_frame.rowconfigure(6, weight=1)

        ttk.Label(self.file_frame, font="verdana 12",
                 text="Combine CSV files or export to XML / plaintext").grid(row=0, column=0, 
                                                                 sticky="news")
        self.csv_scroll = ttk.Scrollbar(self.file_frame)
        self.csv_listbox = tk.Listbox(self.file_frame, selectmode='extended', exportselection=0, 
                                      relief="flat", yscrollcommand=self.csv_scroll.set,
                                      width=60)
        self.csv_scroll.configure(command=self.csv_listbox.yview)
        self.combine_csv_button = tk.Button(self.file_frame, text="Combine files",
                                            command=self.combine_csv_files)
        self.convert_to_xml_button = tk.Button(self.file_frame, text="Convert to .xml", command=self.convert_to_xml)
        self.convert_to_txt_button = tk.Button(self.file_frame, text="Convert to .txt", command=self.convert_to_txt)
        ttk.Label(self.file_frame, text="Filename for combination").grid(row=1, column=3,
                                                                         sticky="new")
        self.combine_csv_var = tk.StringVar()
        self.combine_csv_entry = ttk.Entry(self.file_frame,
                                           textvariable=self.combine_csv_var, width=30)

        self.save_tweet_ids_button = tk.Button(self.file_frame, 
                                                 text="Export list of Tweet IDs",
                                                 command=self.save_tweet_ids)
        self.csv_listbox.grid(row=2, column=0, sticky="news", rowspan=5)
        self.csv_scroll.grid(row=2, column=1, sticky="ns", rowspan=5)
        self.combine_csv_button.grid(row=2, column=2, sticky="new")
        self.combine_csv_entry.grid(row=2, column=3, sticky="new")
        self.convert_to_xml_button.grid(row=3, column=2, sticky="new")
        self.convert_to_txt_button.grid(row=4, column=2, sticky="new")
        self.save_tweet_ids_button.grid(row=5, column=2, sticky="new")
        self.open_csv_dir_button = tk.Button(self.file_frame, text="Open CSV folder",
                                            command=self.open_csv_dir)
        self.open_csv_dir_button.grid(row=6, column=2, sticky="new")
        self.file_list_dirty = True # to check if refresh is needed, e.g. after adding file
项目:gophersnake    作者:felixplesoianu    | 项目源码 | 文件源码
def open_text_viewer(url, data):
    text = data.decode(encoding="latin_1")

    window = Toplevel(top)
    window.title("Gophersnake text viewer")

    textview = Text(window, width=80, height=25, wrap="word")
    textview.insert("1.0", text.replace("\r\n", "\n"))
    window.bind("<Control-a>", lambda e: select_all())
    textview.bind("<Control-c>", lambda e: copy_to_clipboard())
    #textview["state"] = "disabled"

    def select_all():
        textview.tag_remove("sel", "1.0", "end")
        textview.tag_add("sel", "1.0", "end")

    def copy_to_clipboard():
        window.clipboard_clear()
        window.clipboard_append(textview.get("sel.first", "sel.last"))

    textview.grid(row=0, column=0, sticky=(N, S, E, W))
    textview.focus_set()

    textscroll = ttk.Scrollbar(
        window, orient=VERTICAL, command=textview.yview)
    textview["yscrollcommand"] = textscroll.set
    textscroll.grid(row=0, column=1, sticky=(N, S))

    textstatus = ttk.Label(window, text=url)
    textstatus.grid(row=1, column=0, sticky=(E, W))

    textgrip = ttk.Sizegrip(window)
    textgrip.grid(row=1, column=1, sticky=(S, E))

    window.rowconfigure(0, weight=1)
    window.columnconfigure(0, weight=1)

# Broken as of 2016-08-29
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, master, width=None, anchor=N, height=None, mousewheel_speed = 2, scroll_horizontally=True, xscrollbar=None, scroll_vertically=True, yscrollbar=None, outer_background=None, inner_frame=Frame, **kw):
        Frame.__init__(self, master, class_=self.__class__)

        if outer_background:
            self.configure(background=outer_background)

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self._width = width
        self._height = height

        self.canvas = Canvas(self, background=outer_background, highlightthickness=0, width=width, height=height)
        self.canvas.grid(row=0, column=0, sticky=N+E+W+S)

        if scroll_vertically:
            if yscrollbar is not None:
                self.yscrollbar = yscrollbar
            else:
                self.yscrollbar = Scrollbar(self, orient=VERTICAL)
                self.yscrollbar.grid(row=0, column=1,sticky=N+S)

            self.canvas.configure(yscrollcommand=self.yscrollbar.set)
            self.yscrollbar['command']=self.canvas.yview
        else:
            self.yscrollbar = None

        if scroll_horizontally:
            if xscrollbar is not None:
                self.xscrollbar = xscrollbar
            else:
                self.xscrollbar = Scrollbar(self, orient=HORIZONTAL)
                self.xscrollbar.grid(row=1, column=0, sticky=E+W)

            self.canvas.configure(xscrollcommand=self.xscrollbar.set)
            self.xscrollbar['command']=self.canvas.xview
        else:
            self.xscrollbar = None

        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.innerframe = inner_frame(self.canvas, **kw)
        self.innerframe.pack(anchor=anchor)

        self.canvas.create_window(0, 0, window=self.innerframe, anchor='nw', tags="inner_frame")

        self.canvas.bind('<Configure>', self._on_canvas_configure)

        Mousewheel_Support(self).add_support_to(self.canvas, xscrollbar=self.xscrollbar, yscrollbar=self.yscrollbar)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, master, xml=None, heading_text=None, heading_anchor=None, padding=None, cursor=None, takefocus=None, style=None):
        Frame.__init__(self, master, class_="XML_Viwer")

        self._vsb = Scrollbar(self, orient=VERTICAL)
        self._hsb = Scrollbar(self, orient=HORIZONTAL)

        kwargs = {}
        kwargs["yscrollcommand"] = lambda f, l: autoscroll(self._vsb, f, l)
        kwargs["xscrollcommand"] = lambda f, l: autoscroll(self._hsb, f, l)

        if style is not None:
            kwargs["style"] = style

        if padding is not None:
            kwargs["padding"] = padding

        if cursor is not None:
            kwargs["cursor"] = cursor

        if takefocus is not None:
            kwargs["takefocus"] = takefocus

        self._treeview = Treeview(self, **kwargs)

        if heading_text is not None:
            if heading_anchor is not None:
                self._treeview.heading("#0", text=heading_text, anchor=heading_anchor)
            else:
                self._treeview.heading("#0", text=heading_text)

        self._treeview.bind("<<TreeviewOpen>>", self._on_open)
        self._treeview.bind("<<TreeviewClose>>", self._on_close)

        # Without this line, horizontal scrolling doesn't work properly.
        self._treeview.column("#0", stretch= False)

        self._vsb['command'] = self._treeview.yview
        self._hsb['command'] = self._treeview.xview

        self._treeview.grid(column=0, row=0, sticky=N+S+W+E)
        self._vsb.grid(column=1, row=0, sticky=N+S)
        self._hsb.grid(column=0, row=1, sticky=E+W)

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self._element_tree = None
        self._item_ID_to_element = {}

        if xml is not None:
            self.parse_xml(xml)
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def __init__(self, master, width=None, anchor=N, height=None, mousewheel_speed = 2, scroll_horizontally=True, xscrollbar=None, scroll_vertically=True, yscrollbar=None, background=None, inner_frame=Frame, **kw):
        Frame.__init__(self, master, class_="Scrolling_Area", background=background)

        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self._width = width
        self._height = height

        self.canvas = Canvas(self, background=background, highlightthickness=0, width=width, height=height)
        self.canvas.grid(row=0, column=0, sticky=N+E+W+S)

        if scroll_vertically:
            if yscrollbar is not None:
                self.yscrollbar = yscrollbar
            else:
                self.yscrollbar = Scrollbar(self, orient=VERTICAL)
                self.yscrollbar.grid(row=0, column=1,sticky=N+S)

            self.canvas.configure(yscrollcommand=self.yscrollbar.set)
            self.yscrollbar['command']=self.canvas.yview
        else:
            self.yscrollbar = None

        if scroll_horizontally:
            if xscrollbar is not None:
                self.xscrollbar = xscrollbar
            else:
                self.xscrollbar = Scrollbar(self, orient=HORIZONTAL)
                self.xscrollbar.grid(row=1, column=0, sticky=E+W)

            self.canvas.configure(xscrollcommand=self.xscrollbar.set)
            self.xscrollbar['command']=self.canvas.xview
        else:
            self.xscrollbar = None

        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.innerframe = inner_frame(self.canvas, **kw)
        self.innerframe.pack(anchor=anchor)

        self.canvas.create_window(0, 0, window=self.innerframe, anchor='nw', tags="inner_frame")

        self.canvas.bind('<Configure>', self._on_canvas_configure)

        Mousewheel_Support(self).add_support_to(self.canvas, xscrollbar=self.xscrollbar, yscrollbar=self.yscrollbar)
项目:modis    作者:Infraxion    | 项目源码 | 文件源码
def add_help_text(parent, filepath, prefix="!"):
    """
    Load help text from a file and adds it to the parent

    Args:
        parent: A tk or ttk object
        filepath (str): The file to load help text from
        prefix (str): The prefix to use for commands
    """

    import tkinter as tk
    import tkinter.ttk as ttk

    help_contents = get_help_data(filepath)

    text = tk.Text(parent, wrap='word', font=("Helvetica", 10))
    text.grid(row=0, column=0, sticky="W E N S")
    text.tag_config("heading", font=("Helvetica", 14))
    text.tag_config("command", font=("Courier", 10))
    text.tag_config("param", font=("Courier", 10))
    text.tag_config("description")

    # Vertical Scrollbar
    scrollbar = ttk.Scrollbar(parent, orient="vertical", command=text.yview)
    scrollbar.grid(column=1, row=0, sticky="N S")
    text['yscrollcommand'] = scrollbar.set

    # Add the content
    for d in help_contents:
        text.insert('end', d, "heading")
        text.insert('end', '\n')

        if "commands" in d.lower():
            for c in help_contents[d]:
                if "name" not in c:
                    continue

                command = prefix + c["name"]
                text.insert('end', command, ("command", "description"))
                if "params" in c:
                    for param in c["params"]:
                        text.insert('end', " [{}]".format(param), ("param", "description"))
                text.insert('end', ": ")
                if "description" in c:
                    text.insert('end', c["description"], "description")

                text.insert('end', '\n')

            text.insert('end', '\n')
        else:
            text.insert('end', help_contents[d], "description")
            text.insert('end', '\n\n')

    text.config(state=tk.DISABLED)
项目:Quiver    作者:DeflatedPickle    | 项目源码 | 文件源码
def __init__(self, parent, *args, **kwargs):
        tk.Toplevel.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.title("Feather")
        self.geometry("800x400")
        self.minsize(width=300, height=200)
        self.maxsize(width=1000, height=800)
        # self.transient(parent)
        self.rowconfigure(1, weight=1)
        self.columnconfigure(0, weight=1)

        self.file = None

        self.menu = Menu(self)

        self.toolbar = Toolbar(self)
        self.toolbar.grid(row=0, column=0, sticky="we")

        self.statusbar = Statusbar(self)
        self.statusbar.grid(row=2, column=0, sticky="we")

        self.widget_paned_window = ttk.PanedWindow(self, orient="horizontal")
        self.widget_paned_window.grid(row=1, column=0, sticky="nesw")

        self.widget_frame_tree = ttk.Frame(self.widget_paned_window)
        self.widget_frame_tree.rowconfigure(0, weight=1)
        self.widget_frame_tree.columnconfigure(0, weight=1)
        self.widget_paned_window.add(self.widget_frame_tree, weight=1)

        self.widget_treeview = Tree(self.widget_frame_tree, self)
        self.widget_treeview.grid(row=0, column=0, sticky="nesw")
        self.widget_treeview.focus_set()

        self.scrollbar_horizontal = ttk.Scrollbar(self.widget_frame_tree, orient="horizontal",
                                                  command=self.widget_treeview.xview)
        self.scrollbar_horizontal.grid(row=1, column=0, sticky="we")

        self.scrollbar_vertical = ttk.Scrollbar(self.widget_frame_tree, orient="vertical",
                                                command=self.widget_treeview.yview)
        self.scrollbar_vertical.grid(row=0, column=1, sticky="ns")

        self.widget_treeview.configure(xscrollcommand=self.scrollbar_horizontal.set,
                                       yscrollcommand=self.scrollbar_vertical.set)
项目:porcupine    作者:Akuli    | 项目源码 | 文件源码
def __init__(self, manager, content='', path=None):
        super().__init__(manager)

        self._save_hash = None

        # path and filetype are set correctly below
        # TODO: try to guess the filetype from the content when path is None
        self._path = path
        self._guess_filetype()          # this sets self._filetype
        self.bind('<<PathChanged>>', self._update_title, add=True)
        self.bind('<<PathChanged>>', self._guess_filetype, add=True)

        # we need to set width and height to 1 to make sure it's never too
        # large for seeing other widgets
        # TODO: document this
        self.textwidget = textwidget.MainText(
            self, self._filetype, width=1, height=1, wrap='none', undo=True)
        self.textwidget.pack(side='left', fill='both', expand=True)
        self.bind('<<FiletypeChanged>>',
                  lambda event: self.textwidget.set_filetype(self.filetype),
                  add=True)
        self.textwidget.bind('<<ContentChanged>>', self._update_title,
                             add=True)

        if content:
            self.textwidget.insert('1.0', content)
            self.textwidget.edit_reset()   # reset undo/redo

        self.bind('<<PathChanged>>', self._update_status, add=True)
        self.bind('<<FiletypeChanged>>', self._update_status, add=True)
        self.textwidget.bind('<<CursorMoved>>', self._update_status, add=True)

        # everything seems to work ok without this except that e.g.
        # pressing Ctrl+O in the text widget opens a file AND inserts a
        # newline (Tk inserts a newline by default)
        utils.copy_bindings(porcupine.get_main_window(), self.textwidget)

        self.scrollbar = ttk.Scrollbar(self)
        self.scrollbar.pack(side='left', fill='y')
        self.textwidget['yscrollcommand'] = self.scrollbar.set
        self.scrollbar['command'] = self.textwidget.yview

        self.mark_saved()
        self._update_title()
        self._update_status()
项目:PyTouch    作者:mNisblee    | 项目源码 | 文件源码
def __init__(self, master):
        super(TrainingWidget, self).__init__(master)

        self.tm = None
        self._tick_id = None

        # text and scrollbar widget
        self._font = font.Font(family='mono', size=-40)

        self._content_frame = Frame(self)
        self._text = Text(self._content_frame, wrap=NONE, exportselection=0, undo=False)
        self._scrollbar = ttk.Scrollbar(self._content_frame, command=self._text.yview)
        # Connect scrollbar and training widget
        self._text['yscrollcommand'] = self._scrollbar.set

        # text tags
        self._text.tag_config('base', font=self._font, spacing1=20, justify=CENTER)
        self._text.tag_config('untyped', foreground='#cccccc')
        self._text.tag_config('hit')
        self._text.tag_config('miss', foreground='#cc0003')
        # text bindings
        self._text.bind('<Configure>', self.on_configure)
        self._text.bind('<FocusOut>', self.on_focus_out)
        self._text.bind('<KeyPress-Escape>', self.on_escape_press)
        self._text.bind('<KeyPress-BackSpace>', self.on_backspace_press)
        self._text.bind('<KeyPress>', self.on_key_press)
        self._text.bind('<Any-Button>', self.on_button)
        self._text.bind('<Motion>', lambda e: 'break')

        # statistics widgets
        self._time_elem = StatsElement(self, 'Elapsed time', ZERO, ZERO)
        self._strokes_elem = StatsElement(self, 'Keystrokes per minute', '0', '0')
        self._accuracy_elem = StatsElement(self, 'Accuracy', '0', '0')
        self._progressbar = ttk.Progressbar(self, orient='horizontal', mode='determinate', value=0)

        # pack and configure master frame
        self._time_elem.grid(column=0, row=0, sticky=N + S + W + E)
        self._strokes_elem.grid(column=1, row=0, sticky=N + S + W + E)
        self._accuracy_elem.grid(column=2, row=0, sticky=N + S + W + E)
        self._progressbar.grid(column=0, row=1, sticky=N + S + W + E, columnspan=3)
        self._content_frame.grid(column=0, row=2, sticky=N + S + W + E, columnspan=3)

        self.columnconfigure(0, weight=1, minsize=self._time_elem.text_width)
        self.columnconfigure(1, weight=1, minsize=self._strokes_elem.text_width)
        self.columnconfigure(2, weight=1, minsize=self._accuracy_elem.text_width)
        self.rowconfigure(2, weight=1)

        # pack and configure text frame
        self._text.grid(column=0, row=0, sticky=N + E + S + W)
        self._scrollbar.grid(column=1, row=0, sticky=N + E + S + W)

        self._content_frame.columnconfigure(0, weight=1, minsize=400)
        self._content_frame.rowconfigure(0, weight=1)
项目:sorter    作者:giantas    | 项目源码 | 文件源码
def _show_about(self):
        about_window = self._create_window('About Sorter')
        about_window.resizable(height=False, width=False)
        about_window.geometry('+{0}+{1}'.format(300, 150))

        frame = Frame(about_window, relief=SUNKEN)
        frame.pack(side=LEFT, fill=Y)

        about_text = Text(frame, background="white")
        about_text.config(pady=5, padx=10, font='Helvetica 9')
        about_text.pack(side=TOP, fill=X)
        about_text.tag_configure("center", justify='center')
        about_text.tag_configure('big', font=('Helvetica', 20, 'bold'))
        about_text.tag_configure('medium', font=('Helvetica', 12, 'bold'))
        about_text.tag_add("center", 1.0, "end")
        about_text.tag_config("hyperlink", foreground="blue", underline=1)
        about_text.tag_bind("hyperlink", "<Enter>", lambda event,
                            widget=about_text: widget.config(cursor="hand2"))
        about_text.tag_bind("hyperlink", "<Leave>", lambda event,
                            widget=about_text: widget.config(cursor=""))
        about_text.tag_bind("homepage", "<Button-1>", lambda event: self._open_link(
            descriptions.HOMEPAGE, window=about_window))
        about_text.tag_bind("source", "<Button-1>", lambda event: self._open_link(
            descriptions.SOURCE_CODE, window=about_window))

        about_text.insert(END, 'Sorter\n', 'center big')
        about_text.image_create(END, image=self.icon)
        about_text.insert(END, '\n\nv{}'.format(
            SORTER_VERSION), 'center medium')
        about_text.insert(END, '\n{}More information on '.format(
            descriptions.COPYRIGHT_MESSAGE), 'center')
        about_text.insert(END, '{}\n\n'.format(
            descriptions.HOMEPAGE), 'center hyperlink homepage')
        about_text.insert(END, 'Source code at ', 'center')
        about_text.insert(END, '{}\n\n'.format(
            descriptions.SOURCE_CODE), 'center hyperlink source')
        about_text.insert(END, '{:-^40}\n\n'.format(''), 'center medium')
        about_text.insert(END, descriptions.LICENSE)

        scrollbar = ttk.Scrollbar(about_window)
        scrollbar.pack(side=RIGHT, fill=Y)
        scrollbar.config(command=about_text.yview)
        about_text.config(yscrollcommand=scrollbar.set, state="disabled")
项目:birdbody    作者:magnusnissel    | 项目源码 | 文件源码
def draw_streaming(self):
        self.streaming_frame.rowconfigure(0, weight=1)
        self.streaming_frame.rowconfigure(1, weight=1)
        self.streaming_frame.columnconfigure(0, weight=1)
        self.streaming_frame.columnconfigure(1, weight=1)
        self.st_main_frame = tk.Frame(self.streaming_frame)
        self.st_main_frame.grid(row=0, column=0, sticky="news")
        self.st_log_frame = tk.Frame(self.streaming_frame)
        self.st_log_frame.rowconfigure(0, weight=0)
        self.st_log_frame.rowconfigure(1, weight=1)
        self.st_log_frame.columnconfigure(0, weight=1)
        self.st_log_frame.grid(row=0, column=1, sticky="news")
        ttk.Label(self.st_main_frame, text="Enter search strings, one per line",
                                            font="verdana 12").grid(row=0, column=0, sticky="news")
        self.st_search_text = tk.Text(self.st_main_frame)
        ttk.Label(self.st_main_frame, text="Maximum number of tweets (0 = no limit)",
                                            font="verdana 10").grid(row=2, column=0, sticky="news")
        self.st_max_tweets_var = tk.IntVar()
        self.st_max_tweets_spin = tk.Spinbox(self.st_main_frame, from_=0, width=10,
                                             textvariable=self.st_max_tweets_var)
        self.st_max_tweets_var.set(0)
        ttk.Label(self.st_main_frame, text="Filename",
                  font="verdana 10").grid(row=4, column=0, sticky="news")

        self.st_filename_var = tk.StringVar()
        self.st_filename_entry = ttk.Entry(self.st_main_frame, textvariable=self.st_filename_var)
        self.start_stream_button = tk.Button(self.st_main_frame, text="Start streaming", 
                                             command=self.start_streaming)

        self.st_search_text.grid(row=1, column=0, columnspan=2, sticky="news")
        self.st_max_tweets_spin.grid(row=2, column=1, sticky="news")
        self.st_filename_entry.grid(row=5, column=0, columnspan=2, sticky="news")
        self.start_stream_button.grid(row=6, column=0, columnspan=2, sticky="news")
        self.st_convert_json_button = tk.Button(self.st_main_frame,
                                                text="Convert JSON file to CSV", 
                                                command=self.convert_any_json_to_csv)
        self.st_convert_json_button.grid(row=7, column=0, columnspan=2, sticky="news")
        ttk.Label(self.st_main_frame, text="Conversion to CSV follows streaming, but can be started manually if necessary.",
                                            font="verdana 8").grid(row=8, column=0, columnspan=2,
                                                                    sticky="news")
        ttk.Label(self.st_log_frame, text="Log", font="verdana 12").grid(row=0, column=0,
                  sticky="news")
        self.st_log_scroll = ttk.Scrollbar(self.st_log_frame)
        self.st_log_text = tk.Text(self.st_log_frame, yscrollcommand=self.st_log_scroll.set)
        self.st_log_scroll.configure(command=self.st_log_text.yview)
        self.st_log_text.grid(row=1, column=0, sticky="news")
        self.st_log_scroll.grid(row=1, column=1, sticky="news")
        self.clear_log_button = tk.Button(self.st_log_frame, text="Clear log",
                                          command=self.st_clear_log)
        self.clear_log_button.grid(row=2, column=0, columnspan=2, sticky="news")
项目:birdbody    作者:magnusnissel    | 项目源码 | 文件源码
def draw_user_tweets(self):
        self.user_tweets_frame.rowconfigure(0, weight=1)
        self.user_tweets_frame.rowconfigure(1, weight=1)
        self.user_tweets_frame.columnconfigure(0, weight=1)
        self.user_tweets_frame.columnconfigure(1, weight=1)
        self.ut_main_frame = tk.Frame(self.user_tweets_frame)
        self.ut_main_frame.grid(row=0, column=0, sticky="news")
        self.ut_main_frame.rowconfigure(0, weight=0)
        self.ut_main_frame.rowconfigure(1, weight=1)
        self.ut_main_frame.rowconfigure(2, weight=0)
        self.ut_main_frame.rowconfigure(3, weight=0)
        self.ut_main_frame.columnconfigure(0, weight=0)
        self.ut_main_frame.columnconfigure(1, weight=0)
        self.ut_log_frame = tk.Frame(self.user_tweets_frame)
        self.ut_log_frame.rowconfigure(0, weight=0)
        self.ut_log_frame.rowconfigure(1, weight=1)
        self.ut_log_frame.columnconfigure(0, weight=1)
        self.ut_log_frame.grid(row=0, column=1, sticky="news")
        ttk.Label(self.ut_main_frame, font="verdana 12",
                 text="Insert twitter screen names below (one per line)").grid(row=0, column=0, 
                                                                            sticky="news")
        self.screen_names_text = tk.Text(self.ut_main_frame)
        self.screen_names_text.grid(row=1, column=0, columnspan=2, sticky="news")
        self.ut_download_button = tk.Button(self.ut_main_frame,
                                         text="Download tweets", 
                                         command=self.ut_download_tweets)
        self.load_sn_button = tk.Button(self.ut_main_frame, text="Load list of names",
                                        command=self.load_screen_names)
        self.save_sn_button = tk.Button(self.ut_main_frame, text="Save list of names",
                                        command=self.save_screen_names)
        self.load_sn_button.grid(row=2, column=0, sticky="news")
        self.save_sn_button.grid(row=2, column=1, sticky="news")
        self.ut_download_button.grid(row=3, column=0, columnspan=2, sticky="news")
        # Log
        ttk.Label(self.ut_log_frame, text="Log", font="verdana 12").grid(row=0, column=0, sticky="news")
        self.ut_log_scroll = ttk.Scrollbar(self.ut_log_frame)
        self.ut_log_text = tk.Text(self.ut_log_frame, yscrollcommand=self.ut_log_scroll.set)
        self.ut_log_scroll.configure(command=self.ut_log_text.yview)
        self.ut_log_text.grid(row=1, column=0, sticky="news")
        self.ut_log_scroll.grid(row=1, column=1, sticky="news")
        self.clear_log_button = tk.Button(self.ut_log_frame, text="Clear log",
                                          command=self.ut_clear_log)
        self.clear_log_button.grid(row=2, column=0, columnspan=2, sticky="news")
项目:birdbody    作者:magnusnissel    | 项目源码 | 文件源码
def draw_tweet_id(self):
        # === tweet ID === # 
        self.tweet_id_frame.rowconfigure(0, weight=1)
        self.tweet_id_frame.rowconfigure(1, weight=1)
        self.tweet_id_frame.columnconfigure(0, weight=1)
        self.tweet_id_frame.columnconfigure(1, weight=1)
        self.ti_main_frame = tk.Frame(self.tweet_id_frame)
        self.ti_main_frame.grid(row=0, column=0, sticky="news")
        self.ti_main_frame.rowconfigure(0, weight=0)
        self.ti_main_frame.rowconfigure(1, weight=1)
        self.ti_main_frame.rowconfigure(2, weight=0)
        self.ti_main_frame.rowconfigure(3, weight=0)
        self.ti_main_frame.columnconfigure(0, weight=0)
        self.ti_main_frame.columnconfigure(1, weight=0)
        self.ti_log_frame = tk.Frame(self.tweet_id_frame)
        self.ti_log_frame.rowconfigure(0, weight=0)
        self.ti_log_frame.rowconfigure(1, weight=1)
        self.ti_log_frame.columnconfigure(0, weight=1)
        self.ti_log_frame.grid(row=0, column=1, sticky="news")
        ttk.Label(self.ti_main_frame, font="verdana 12",
                 text="Insert Tweet IDs below (one per line)").grid(row=0, column=0, sticky="news")
        self.tweet_ids_text = tk.Text(self.ti_main_frame)
        self.tweet_ids_text.grid(row=1, column=0, columnspan=2, sticky="news")

        self.ti_filename_var = tk.StringVar()
        self.ti_filename_entry = ttk.Entry(self.ti_main_frame, textvariable=self.ti_filename_var)
        self.ti_download_button = tk.Button(self.ti_main_frame,
                                         text="Download tweets", 
                                         command=self.ti_download_tweets)
        self.load_ti_button = tk.Button(self.ti_main_frame, text="Load list of Tweet IDs",
                                        command=self.load_tweet_ids)
        self.load_ti_button.grid(row=2, column=0, columnspan=2, sticky="news")
        ttk.Label(self.ti_main_frame, font="verdana 10", text="Filename").grid(row=3, column=0,
                                                                               sticky="news")
        self.ti_filename_entry.grid(row=4, column=0, columnspan=2, sticky="news")
        self.ti_download_button.grid(row=5, column=0, columnspan=2, sticky="news")
        # Log
        ttk.Label(self.ti_log_frame, text="Log", font="verdana 12").grid(row=0, column=0, sticky="news")
        self.ti_log_scroll = ttk.Scrollbar(self.ti_log_frame)
        self.ti_log_text = tk.Text(self.ti_log_frame, yscrollcommand=self.ut_log_scroll.set)
        self.ti_log_scroll.configure(command=self.ti_log_text.yview)
        self.ti_log_text.grid(row=1, column=0, sticky="news")
        self.ti_log_scroll.grid(row=1, column=1, sticky="news")
        self.clear_log_button = tk.Button(self.ti_log_frame, text="Clear log",
                                          command=self.ti_clear_log)
        self.clear_log_button.grid(row=2, column=0, columnspan=2, sticky="news")