Mailing List Archive

[Tkinter] Placing a ScrolledText on a Canvas?
The subject says it all, really... I would like to have a window with som=
e
fancy background, yet full functionality. So I thought, I use a Canvas, p=
ut an
image on it, then put additional components on it. So far it works
reasonably... I put an Entry on it (=3D=3D 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=
=2E The
following code demonstrates this:

from Tkinter import *
from ScrolledText import ScrolledText

root =3D Tk()
root.canvas =3D Canvas(root, width=3D400, height=3D580,
background=3D'gray',relief=3DSUNKEN)
root.canvas.pack()

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

entry =3D Entry(root, width=3D38)
entry1 =3D root.canvas.create_window(60, 490, anchor=3DNW, window=3Dentry=
)

textBox =3D ScrolledText(root, width=3D15, height=3D30)
textBox1 =3D root.canvas.create_window(50, 100, anchor=3DNW, window=3Dtex=
tBox)

root.mainloop()

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

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

Thanks,
Def P


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