Tkinter Tutorial - Scrollbar

Tkinter Tutorial - Scrollbar

The Tkinter Scrollbar widget is normally used to scroll widgets like ListBox, Text or Canvas vertically, or Entry horizontally. It shows a slider in the right position. Tkinter ScrollBar import tkinter as tk class Scrollbar_Example: def __init__(self): self.window = tk.Tk() self.scrollbar = tk.Scrollbar(self.window) self.scrollbar.pack(side="right", fill="y") self.listbox = tk.Listbox(self.window, yscrollcommand=self.scrollbar.set) for i in range(100): self.listbox.insert("end", str(i)) self.listbox.pack(side="left", fill="both") self.scrollbar.config(command=self.listbox.yview) self.window.mainloop() if __name__ == "__main__": app = Scrollbar_Example() self.scrollbar = tk.Scrollbar(self.window) It initiates the Scrollbar instance.


Tkinter Label Tkinter Checkbutton Tkinter Radiobutton Tkinter Combobox Tkinter Menubar Tkinter Scale Tkinter Message Box Tkinter Scrollbar

Most Popular Articles

Recently Updated Articles