[Tutor] Scrollbar

Alan Gauld alan.gauld at yahoo.co.uk
Mon Mar 27 14:38:57 EDT 2017


On 27/03/17 17:22, Pooja Bhalode wrote:

> The scrollbar goes not work in the window. 

Define 'not work'?

You haven't connected it to anything and it doesn't
respond to any events so what kind of work did you
expect it to do? I assume it draws itself on screen
and the scroll buttons operate OK when you click them?

To make it do anything else you need to connect
it to a scrollable widget or bind some actions
to its events. Which Tkinter tutorial are you
using? It should have explained how to do that.

> from Tkinter import *
> 
> root = Tk()
> root.geometry("500x400")
> scrollbar = Scrollbar(root, orient = "vertical")
> scrollbar.grid(column = 5,sticky = W)
> 
> for i in range(0,20):
> Label(root, text = i).grid(row = 1+i, column = 1, sticky = W)
> 
> root.mainloop()


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list