Question: Tkinter Python hear is my code. i am trying to add scrollbar on frame_right for scrolling multiple images but scrollbar is not working properly from

Tkinter Python

hear is my code.

i am trying to add scrollbar on frame_right for scrolling multiple images

but scrollbar is not working properly

from tkinter import * from PIL import Image, ImageTk import tkinter as tk # For Title master = tk.Tk() master.title('Nike Men Shoes') master.geometry('{}x{}'.format(1300, 790)) # TOP Frame frame_top = Frame(master, width=1500, height=58, bg="white") frame_top.grid(row=0, sticky="ew") frame_top1 = Frame(master, width=1300, height=58, bg="#ccc") frame_top1.grid(row=1, sticky="ew") # Frame Left frame_left = Frame(master, width=300, height=674, bg="white") frame_left.grid(row=2, sticky="w") def r1(): print(RunningShoes()) print(Rl()) LabelRunning = Label(frame_left, text="Men Shoes", bg="white", font="black") # Men Shoes Label LabelRunning.place(x=60, y=20) LabelRunning = Button(frame_left, text="Running", bg="white", bd=0, font="black", activeforeground="Grey", activebackground="white", command=r1) # Running Label LabelRunning.place(x=60, y=80) def Rl(): LabelRunning1 = Label(frame_left, text="Men's Running Shoes", bg="white", font="black") # Display on Left Frame LabelRunning1.place(x=60, y=20) # Frame_right frame_right = Frame(master, width=900, height=674, bg="#efefef") frame_right.grid(row=2, sticky="e") sb = Scrollbar(frame_right) myc = Scrollbar(frame_right) myc.pack(side=RIGHT, fill=Y) sb = Listbox(frame_right, width=108, height=28, bd=0, bg="#efefef", yscrollcommand=sb.set) sb.pack(side=LEFT, fill=Y) myc.config(command=sb.yview) def RunningShoes(): image = Image.open("Running Shoes images/R1.jpg") imageR1 = ImageTk.PhotoImage(image) img_button = tk.Button(sb, image=imageR1, bd=0) img_button.image = imageR1 img_button.grid(row=0, column=1, padx=10, pady=10) image = Image.open("Running Shoes images/R2.jpg") imageR2 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR2, bd=0) Image_Button.image = imageR2 Image_Button.grid(row=0, column=2, padx=10, pady=10) image = Image.open("Running Shoes images/R3.jpg") imageR3 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR3, bd=0) Image_Button.image = imageR3 Image_Button.grid(row=0, column=3) image = Image.open("Running Shoes images/R4.jpg") imageR4 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR3, bd=0) Image_Button.image = imageR4 Image_Button.grid(row=1, column=1, padx=10, pady=10) image = Image.open("Running Shoes images/R5.jpg") imageR5 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR5, bd=0) Image_Button.image = imageR5 Image_Button.grid(row=1, column=2, padx=10, pady=10) image = Image.open("Running Shoes images/R6.jpg") imageR6 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR6, bd=0) Image_Button.image = imageR6 Image_Button.grid(row=1, column=3, padx=10, pady=10) image = Image.open("Running Shoes images/R6.jpg") imageR7 = ImageTk.PhotoImage(image) Image_Button = tk.Button(sb, image=imageR6, bd=0) Image_Button.image = imageR7 Image_Button.grid(row=3, column=1, padx=10, pady=10) master.grid_rowconfigure(2, weight=1) master.grid_columnconfigure(0, weight=1) master.mainloop() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!