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
  Trying to make random image loop in Tk window using python Jediguy18 1 193 Dec-30-2020, 04:56 AM
Last Post: deanhystad
  function in new window (tkinter) Dale22 7 367 Nov-24-2020, 11:28 PM
Last Post: Dale22
  Latex image too big on tkinter using sympy 4096 1 240 Nov-05-2020, 08:05 AM
Last Post: DPaul
Photo Tkinter TEXT background image _ShevaKadu 5 1,172 Nov-02-2020, 10:34 AM
Last Post: joe_momma
  tkinter: Image to Label Maryan 10 491 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Run more than one window together with tkinter SmukasPlays 1 347 Aug-24-2020, 05:00 PM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 1,295 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  [Tkinter] calling a new window from a tkinter window neuroprogrammer 2 441 Jul-28-2020, 10:59 PM
Last Post: deanhystad
  How to display results from terminal window onto tkinter. buttercup 0 335 Jul-21-2020, 04:41 AM
Last Post: buttercup
  Create image on a Toplevel using tkinter ViktorWong 3 1,943 Jun-13-2020, 03:21 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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