Python tkinter.Scrollbar() Examples
The following are 30
code examples of tkinter.Scrollbar().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.
Example #1
Source File: view.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 8 votes |
def create_list_box(self): frame = tk.Frame(self.root) self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2', bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10) self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.list_box.bind( "<Double-Button-1>", self.on_play_list_double_clicked) self.list_box.bind("<Button-3>", self.show_context_menu) scroll_bar = tk.Scrollbar(frame) scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH) self.list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=self.list_box.yview) frame.grid(row=4, padx=5, columnspan=10, sticky='ew')
Example #2
Source File: chartparser_app.py From razzy-spinner with GNU General Public License v3.0 | 7 votes |
def _sb_canvas(self, root, expand='y', fill='both', side='bottom'): """ Helper for __init__: construct a canvas with a scrollbar. """ cframe =tkinter.Frame(root, relief='sunk', border=2) cframe.pack(fill=fill, expand=expand, side=side) canvas = tkinter.Canvas(cframe, background='#e0e0e0') # Give the canvas a scrollbar. sb = tkinter.Scrollbar(cframe, orient='vertical') sb.pack(side='right', fill='y') canvas.pack(side='left', fill=fill, expand='yes') # Connect the scrollbars to the canvas. sb['command']= canvas.yview canvas['yscrollcommand'] = sb.set return (sb, canvas)
Example #3
Source File: turtle.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #4
Source File: turtle.py From android_universal with MIT License | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #5
Source File: SikuliGui.py From lackey with MIT License | 6 votes |
def __init__(self, master, textvariable=None, *args, **kwargs): tk.Frame.__init__(self, master) # Init GUI self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs) self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self._y_scrollbar.config(command=self._text_widget.yview) self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y) if textvariable is not None: if not isinstance(textvariable, tk.Variable): raise TypeError("tkinter.Variable type expected, {} given.".format( type(textvariable))) self._text_variable = textvariable self.var_modified() self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified) self._var_trace = textvariable.trace("w", self.var_modified)
Example #6
Source File: scroll.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, initwidget, nmemb, orient=tk.HORIZONTAL, reverse=False, **kwargs): assert callable(initwidget) super().__init__(master, **kwargs) self._interior = tk.Frame(self) self.scroller = ScrollingUpdate(self, initlist=[initwidget(master=self._interior) for i in range(nmemb)], orient=orient, reverse=reverse) self.scrollbar = tk.Scrollbar(self, orient=orient) if orient == tk.HORIZONTAL: self.grid_columnconfigure(0, weight=1) self._interior.grid(row=0, column=0, sticky="nswe") self.scrollbar.grid(row=1, column=0, sticky="nswe") elif orient == tk.VERTICAL: self.grid_rowconfigure(0, weight=1) self._interior.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) self.scrollbar.pack(side=tk.LEFT, fill=tk.Y) self.orient = orient
Example #7
Source File: tkwidgets.py From hwk-mirror with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, **kwargs): super().__init__(parent, highlightthickness=0, **kwargs) vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) vscrollbar.pack(side=tk.RIGHT, fill=tk.Y) self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0, yscrollcommand=vscrollbar.set) canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True) vscrollbar.config(command=canvas.yview) canvas.xview_moveto(0) canvas.yview_moveto(0) self.interior = interior = tk.Frame(canvas) self.interior_id = canvas.create_window(0, 0, window=interior, anchor=tk.NW) self.interior.bind("<Configure>", self.configure_interior) self.canvas.bind("<Configure>", self.configure_canvas) self.scrollbar = vscrollbar self.mouse_position = 0
Example #8
Source File: turtle.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #9
Source File: pykms_GuiMisc.py From py-kms with The Unlicense | 6 votes |
def __init__(self, master, radios, font, changed, **kwargs): tk.Frame.__init__(self, master) self.master = master self.radios = radios self.font = font self.changed = changed self.scrollv = tk.Scrollbar(self, orient = "vertical") self.textbox = tk.Text(self, yscrollcommand = self.scrollv.set, **kwargs) self.scrollv.config(command = self.textbox.yview) # layout. self.scrollv.pack(side = "right", fill = "y") self.textbox.pack(side = "left", fill = "both", expand = True) # create radiobuttons. self.radiovar = tk.StringVar() self.radiovar.set('FILE') self.create()
Example #10
Source File: turtle.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #11
Source File: scrolledtext.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() methods = methods.difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #12
Source File: turtle.py From Imogen with MIT License | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #13
Source File: menotexport-gui.py From Menotexport with GNU General Public License v3.0 | 6 votes |
def addMessageFrame(self): frame=Frame(self) frame.pack(fill=tk.BOTH,side=tk.TOP,\ expand=1,padx=8,pady=5) self.messagelabel=tk.Label(frame,text='Message',bg='#bbb') self.messagelabel.pack(side=tk.TOP,fill=tk.X) self.text=tk.Text(frame) self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1) self.text.height=10 scrollbar=tk.Scrollbar(self.text) scrollbar.pack(side=tk.RIGHT,fill=tk.Y) self.text.config(yscrollcommand=scrollbar.set) scrollbar.config(command=self.text.yview)
Example #14
Source File: scrolledtext.py From ironpython3 with Apache License 2.0 | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() methods = methods.difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #15
Source File: gui_mgr.py From plex-mpv-shim with MIT License | 6 votes |
def run(self): root = tk.Tk() self.root = root root.title("Application Log") text = tk.Text(root) text.pack(side=tk.LEFT, fill=tk.BOTH, expand = tk.YES) text.config(wrap=tk.WORD) self.text = text yscroll = tk.Scrollbar(command=text.yview) text['yscrollcommand'] = yscroll.set yscroll.pack(side=tk.RIGHT, fill=tk.Y) text.config(state=tk.DISABLED) self.update() root.mainloop() self.r_queue.put(("die", None)) # Q: OK. So you put Tkinter in it's own process. # Now why is Pystray in another process too?! # A: Because if I don't, MPV and GNOME Appindicator # try to access the same resources and cause the # entire application to segfault. # # I suppose this means I can put the Tkinter GUI back # into the main process. This is true, but then the # two need to be merged, which is non-trivial.
Example #16
Source File: turtle.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #17
Source File: scrolledtext.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() methods = methods.difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #18
Source File: view.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 6 votes |
def create_list_box(self): frame = tk.Frame(self.root) self.list_box = tk.Listbox(frame, activestyle='none', cursor='hand2', bg='#1C3D7D', fg='#A0B9E9', selectmode=tk.EXTENDED, height=10) self.list_box.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.list_box.bind( "<Double-Button-1>", self.on_play_list_double_clicked) self.list_box.bind("<Button-3>", self.show_context_menu) scroll_bar = tk.Scrollbar(frame) scroll_bar.pack(side=tk.RIGHT, fill=tk.BOTH) self.list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=self.list_box.yview) frame.grid(row=4, padx=5, columnspan=10, sticky='ew')
Example #19
Source File: turtle.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #20
Source File: clai_emulator.py From clai with MIT License | 5 votes |
def add_list_commands(self, root): canvas = tk.Canvas(root, borderwidth=0) self.frame = tk.Frame(canvas) scrollbar = tk.Scrollbar(root, orient="vertical", command=canvas.yview) canvas.configure(yscrollcommand=scrollbar.set) scrollbar.pack(side="right", fill="y") canvas.pack(fill="both", expand=True) self.canvas_frame = canvas.create_window((4, 4), window=self.frame, anchor="nw") canvas.bind('<Configure>', lambda event, canvas=canvas: self.canvas_resize(event, canvas)) self.frame.bind("<Configure>", lambda event, canvas=canvas: self.on_configure(canvas)) self.frame.bind_all("<MouseWheel>", lambda event, canvas=canvas: canvas.yview_scroll(-1 * event.delta, "units")) self.canvas = canvas
Example #21
Source File: ttk.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient """ Widget.__init__(self, master, "ttk::scrollbar", kw)
Example #22
Source File: ListPanel.py From Python-Media-Player with Apache License 2.0 | 5 votes |
def create_song_list_panel(self): # Creating Picture Canvas as Background background=Tkinter.PhotoImage(file="../Icons/background.gif") mainframe=Tkinter.Canvas(self.root) mainframe.pack(side='top', expand='yes', fill='both') mainframe.image=background mainframe.create_image(0, 0, anchor="nw", image=background) frame0=Tkinter.Frame(mainframe) frame0.pack(side='top') Tkinter.Label(frame0, text='Search : ', bg='skyblue').pack(side='left', expand='yes', fill='x') Tkinter.Entry(frame0, textvariable=self.var1).pack(side='left', expand='yes', fill='x') frame0.bind_all('<Any-KeyPress>',self.search_song_trigger) frame=Tkinter.Frame(mainframe, bg='skyblue') frame.pack(side='top') self.list_box=Tkinter.Listbox(frame, bg='powderblue', font=list_box_song_list_font, width=list_box_width, height=list_box_height) scrollbar=Tkinter.Scrollbar(frame, bg='skyblue') scrollbar.pack(side='right',expand='yes',fill='y') scrollbar.config(command=self.list_box.yview) self.list_box.config(yscrollcommand=scrollbar.set) self.list_box.pack(expand='yes',fill='both',side='right') frame1=Tkinter.Frame(mainframe, bg='blue') frame1.pack(side='top', expand='yes',fill='x') add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif") add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif") list_file=[ (add_fileicon,'self.ask_for_play_song_direct'), (add_directoryicon,'self.ask_for_directory'), ] for i,j in list_file: storeobj=Tkinter.Button(frame1, image=i, command=eval(j), bg='blue') storeobj.pack(side='left') storeobj.image=i self.list_box.bind('<Double-Button-1>',self.play_on_click) return self.update_list_box_songs()
Example #23
Source File: reddit.py From Social-Amnesia with GNU General Public License v3.0 | 5 votes |
def build_window(root, window, title_text): def onFrameConfigure(canvas): '''Reset the scroll region to encompass the inner frame''' canvas.configure(scrollregion=canvas.bbox('all')) canvas = tk.Canvas(window, width=750, height=1000) frame = tk.Frame(canvas) scrollbar = tk.Scrollbar(window, command=canvas.yview) canvas.configure(yscrollcommand=scrollbar.set) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) canvas.create_window((4, 4), window=frame, anchor="nw") title_label = tk.Label( frame, text=title_text, font=('arial', 30)) frame.bind("<Configure>", lambda event, canvas=canvas: onFrameConfigure(canvas)) title_label.grid( row=0, column=0, columnspan=2, sticky='w') ttk.Separator(frame, orient=tk.HORIZONTAL).grid( row=2, columnspan=2, sticky='ew', pady=5) return frame
Example #24
Source File: test_widgets.py From ironpython3 with Apache License 2.0 | 5 votes |
def create(self, **kwargs): return tkinter.Scrollbar(self.root, **kwargs)
Example #25
Source File: 6.01.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_scroll_bar(self): x_scroll = tk.Scrollbar(self.canvas_frame, orient="horizontal") x_scroll.pack(side="bottom", fill="x") x_scroll.config(command=self.canvas.xview) y_scroll = tk.Scrollbar(self.canvas_frame, orient="vertical") y_scroll.pack(side="right", fill="y") y_scroll.config(command=self.canvas.yview) self.canvas.config( xscrollcommand=x_scroll.set, yscrollcommand=y_scroll.set)
Example #26
Source File: ttk.py From ironpython3 with Apache License 2.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient """ Widget.__init__(self, master, "ttk::scrollbar", kw)
Example #27
Source File: twitter.py From Social-Amnesia with GNU General Public License v3.0 | 5 votes |
def build_window(root, window, title_text): def onFrameConfigure(canvas): '''Reset the scroll region to encompass the inner frame''' canvas.configure(scrollregion=canvas.bbox('all')) canvas = tk.Canvas(window, width=750, height=1000) frame = tk.Frame(canvas) scrollbar = tk.Scrollbar(window, command=canvas.yview) canvas.configure(yscrollcommand=scrollbar.set) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=True) canvas.create_window((4, 4), window=frame, anchor="nw") title_label = tk.Label( frame, text=title_text, font=('arial', 30)) frame.bind("<Configure>", lambda event, canvas=canvas: onFrameConfigure(canvas)) title_label.grid( row=0, column=0, columnspan=2, sticky='w') ttk.Separator(frame, orient=tk.HORIZONTAL).grid( row=2, columnspan=2, sticky='ew', pady=5) return frame
Example #28
Source File: app.py From captcha_trainer with Apache License 2.0 | 5 votes |
def listbox_scrollbar(listbox: tk.Listbox): y_scrollbar = tk.Scrollbar( listbox, command=listbox.yview ) y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y) listbox.config(yscrollcommand=y_scrollbar.set)
Example #29
Source File: help.py From ironpython3 with Apache License 2.0 | 5 votes |
def __init__(self, parent, filename): Frame.__init__(self, parent) text = HelpText(self, filename) self['background'] = text['background'] scroll = Scrollbar(self, command=text.yview) text['yscrollcommand'] = scroll.set self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) # text self.toc_menu(text).grid(column=0, row=0, sticky='nw') text.grid(column=1, row=0, sticky='nsew') scroll.grid(column=2, row=0, sticky='ns')
Example #30
Source File: test_widgets.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def create(self, **kwargs): return tkinter.Scrollbar(self.root, **kwargs)