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
  Run more than one window together with tkinter SmukasPlays 1 206 Aug-24-2020, 05:00 PM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 519 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  [Tkinter] calling a new window from a tkinter window neuroprogrammer 2 283 Jul-28-2020, 10:59 PM
Last Post: deanhystad
  How to display results from terminal window onto tkinter. buttercup 0 194 Jul-21-2020, 04:41 AM
Last Post: buttercup
  Create image on a Toplevel using tkinter ViktorWong 3 1,518 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  [Tkinter] Tkinter Logo Image Evil_Patrick 1 599 May-25-2020, 05:12 AM
Last Post: DT2000
  Tkinter: multitab window WizardMitMagi 3 483 Apr-29-2020, 02:40 PM
Last Post: deanhystad
  tkinter.TclError: bad window path name kenwatts275 3 1,362 Apr-26-2020, 08:16 PM
Last Post: kenwatts275
  tkinter and image paths menator01 2 421 Apr-14-2020, 08:46 PM
Last Post: menator01
  Using Tkinter widgets on child window chewy1418 8 1,457 Feb-27-2020, 10:34 PM
Last Post: Marbelous

Forum Jump:

User Panel Messages

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