[Tkinter] Placing a ScrolledText on a Canvas?

Def P def-p at usa.net
Sun Jun 20 09:29:57 EDT 1999

The subject says it all, really... I would like to have a window with some
fancy background, yet full functionality. So I thought, I use a Canvas, put an
image on it, then put additional components on it. So far it works
reasonably... I put an Entry on it (== the Canvas with PhotoImage on it), with
no problems at all.

However, I cannot seem to manage to put a ScrolledText on the same Canvas. The
following code demonstrates this:

from Tkinter import *
from ScrolledText import ScrolledText

root = Tk()
root.canvas = Canvas(root, width=400, height=580,

photo = PhotoImage(file="c:/multimedia/pix/SmallerDragonBanner.gif")
item = root.canvas.create_image(1, 1, anchor=NW, image=photo)

entry = Entry(root, width=38)
entry1 = root.canvas.create_window(60, 490, anchor=NW, window=entry)

textBox = ScrolledText(root, width=15, height=30)
textBox1 = root.canvas.create_window(50, 100, anchor=NW, window=textBox)


I cannot copy the exact error message but it says that it "can't use
.8201376.text in a window item of this canvas"...

Am I doing something wrong, or is a ScrolledText "just" an item that cannot be
put on a canvas?

Def P

Get free e-mail and a permanent address at http://www.netaddress.com/?N=1

More information about the Python-list mailing list