Example:
******Your code Below *****
from tkinter import *
root = Tk()
root.title("Listbox Yscrollcommand")
root.config(background="#ADFF2F")
root.geometry("350x550+350+86")
my_label= Label(root, text="Your Listbox Here",
font=("Times", 30, "bold"),bg="#EE7942",relief=SUNKEN)
my_label.pack(pady=15)
my_scrollbar = Scrollbar(root)
my_scrollbar.pack(side="right", fill="both")
my_listbox= Listbox(root, height=12, width=15,bg="#FFD39B",fg="#B23AEE",
bd=10, font=("Helvetica", 20, "bold"),
highlightcolor="white")
my_listbox.pack()
for i in range(100):
my_listbox.insert(END,i)
my_listbox.config(yscrollcommand=my_scrollbar.set)
my_scrollbar.config(command=my_listbox.yview)
root.mainloop()
from tkinter import *
root = Tk()
root.title("Listbox Yscrollcommand")
root.config(background="#ADFF2F")
root.geometry("350x550+350+86")
my_label= Label(root, text="Your Listbox Here",
font=("Times", 30, "bold"),bg="#EE7942",relief=SUNKEN)
my_label.pack(pady=15)
my_scrollbar = Scrollbar(root)
my_scrollbar.pack(side="right", fill="both")
my_listbox= Listbox(root, height=12, width=15,bg="#FFD39B",fg="#B23AEE",
bd=10, font=("Helvetica", 20, "bold"),
highlightcolor="white")
my_listbox.pack()
for i in range(100):
my_listbox.insert(END,i)
my_listbox.config(yscrollcommand=my_scrollbar.set)
my_scrollbar.config(command=my_listbox.yview)
root.mainloop()
Post a Comment