Python Forum

Full Version: Scrollable big image in a window (TKinter)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Im trying to make a scrollable image in a window in TKinter. Its enough to scroll the image upwards and downwards, theres no need for scrolling left and right. With my code the window shows the image and the scrollbars, but scrolling does not work. The image stays fixed and is not moveable. Can someone help me?

def rdp():

    root5 = Toplevel()
    root5.title("GeoDocPro")
    root5.state('zoomed')
    scrollbar = Scrollbar(root5)
    scrollbar.pack( side = RIGHT, fill = Y )
    img = ImageTk.PhotoImage(Image.open("C:\Software_Development/RDP.jpg"))
    panel = Label(root5, image = img)
    panel.pack(side = "bottom", fill = "both", expand = "no")
    scrollbar.config( command = root5.yview )
    root5.mainloop()
please include enough code so that it can be run.
Thank you
Thanks Larz, and Hello;-)

Sorry its my first few minutes in this forum.

This error occurs when I run my code:

File "C:\Software_Development\Gpr_Calculator_aktuell8.py", line 104, in rdp
scrollbar.config( command = root5.yview )
AttributeError: 'Toplevel' object has no attribute 'yview'
Again, please include enough code so that it can be run.