ScrolledText Widget
Hans Nowak
ivnowa at hvision.nl
Mon Sep 27 17:44:52 EDT 1999
On 26 Sep 99, rainer2207 at my-deja.com wrote:
> I haven't seen any examples on how to use the ScrolledText widget. I'm
> trying to create a toplevel window which displays the contents of a file.
> Can anyone tell me how to use this widget or another way of doing this?
> Thanks.
The attached code doesn't read a file, but it might give you an idea
of how ScrolledText works...
--Hans Nowak (zephyrfalcon at hvision.nl)
Homepage: http://fly.to/zephyrfalcon
Python Snippets: http://tor.dhs.org/~zephyrfalcon/snippets/
The Purple Kookaburra Forum: http://www.delphi.com/kookaburra/
-------------- next part --------------
#
from Tkinter import *
from ScrolledText import ScrolledText
class TextThingy (Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.entry = Entry(self)
self.entry.pack(fill=X, pady=5)
self.entry.bind("<Key-Return>", self.blurb)
self.text = ScrolledText(self, state=DISABLED, height=10)
self.text.pack()
def blurb(self, event):
text = self.entry.get() + "\n"
self.entry.delete(0, END)
self.text.config(state=NORMAL)
self.text.insert(END, text)
self.text.config(state=DISABLED)
TextThingy().mainloop()
More information about the Python-list
mailing list