Python Forum
Scrollable big image in a window (TKinter)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrollable big image in a window (TKinter)
#1
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()
Reply
#2
please include enough code so that it can be run.
Thank you
Reply
#3
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'
Reply
#4
Again, please include enough code so that it can be run.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter weird image displaying behaviour pyDream 2 1,016 Oct-18-2025, 11:15 AM
Last Post: deanhystad
  Tkinter: An image and label are not appearing. emont 7 5,967 Jul-28-2025, 09:40 AM
Last Post: enablespindle
  Tkinter multiple windows in the same window hosierycouch 1 2,006 May-30-2024, 04:28 AM
Last Post: deanhystad
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 4,032 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  Tkinter multiple windows in the same window tomro91 1 2,913 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  Centering and adding a push button to a grid window, TKinter Edward_ 15 20,994 May-25-2023, 07:37 PM
Last Post: deanhystad
  [PyQt] PyQt5 drawing on scrollable area HeinKurz 3 3,026 Mar-28-2023, 12:58 PM
Last Post: Axel_Erfurt
  My Background Image Is Not Appearing (Python Tkinter) HailyMary 2 13,907 Mar-14-2023, 06:13 PM
Last Post: deanhystad
  simple tkinter question function call not opening image gr3yali3n 5 8,771 Aug-02-2022, 09:13 PM
Last Post: woooee
  [Tkinter] Tkinter don't change the image DQT 2 3,862 Jul-22-2022, 10:26 AM
Last Post: menator01

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020