Tkinter: scrolling the canvas items AND widgets

jmdeschamps jmdeschamps at
Thu Sep 19 22:55:06 CEST 2002

I'm trying to use canvas as a scrollable region to make dynamic entry
forms (variable number of Entry fields).
I would like to be able to scroll down the canvas if the fields go
outside the visible region using scrollbars :)
This code lets me scroll the graphical items but the widgets stay put
using PythonWin 2.2.1 on Windows 2000
import Tkinter

root = Tkinter.Tk()

# Create widgets
canvas = Tkinter.Canvas(root)
# Vertical scroll bar
verticalScrollbar = Tkinter.Scrollbar(root)                       
# Configure
root.rowconfigure(0, weight=1)
root.columnconfigure(0, weight=1)
canvas.config(   height = 300,                    
    scrollregion = (0, 0, 100, 1000),
    yscrollcommand=verticalScrollbar.set )
    command = canvas.yview)
# Draw on canvas
canvas.create_polygon(10, 10, 300, 50, 10, 100)
#Add widgets
for i in range(1):

**** end code *******

With this, I can scroll the polygon but not the Entry field ???

Thanks in advance,


More information about the Python-list mailing list