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
Question [Tkinter] Scrollable Treeview: change behavior of Prior/Next keys? RockDoctor 2 220 Apr-10-2021, 05:40 PM
Last Post: RockDoctor
  tkinter button image Nick_tkinter 4 399 Mar-04-2021, 11:33 PM
Last Post: deanhystad
  how to resize image in canvas tkinter samuelmv30 2 1,243 Feb-06-2021, 03:35 PM
Last Post: joe_momma
  "tkinter.TclError: NULL main window" Rama02 1 420 Feb-04-2021, 06:45 PM
Last Post: deanhystad
  Trying to make random image loop in Tk window using python Jediguy18 1 374 Dec-30-2020, 04:56 AM
Last Post: deanhystad
  function in new window (tkinter) Dale22 7 639 Nov-24-2020, 11:28 PM
Last Post: Dale22
  Latex image too big on tkinter using sympy 4096 1 477 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 1,858 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  tkinter: Image to Label Maryan 10 904 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Run more than one window together with tkinter SmukasPlays 1 474 Aug-24-2020, 05:00 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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