Python Forum
Scrollable big image in a window (TKinter) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: Scrollable big image in a window (TKinter) (/thread-29628.html)



Scrollable big image in a window (TKinter) - Prospekteur - Sep-13-2020

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()



RE: Scrollable big image in a window (TKinter) - Larz60+ - Sep-13-2020

please include enough code so that it can be run.
Thank you


RE: Scrollable big image in a window (TKinter) - Prospekteur - Sep-13-2020

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'


RE: Scrollable big image in a window (TKinter) - Larz60+ - Sep-14-2020

Again, please include enough code so that it can be run.