Hi Sorin.
Full example with at least vertical scrolling
from Tkinter import *
class ScrolledText(Frame):
def __init__(self, master, **keywords):
# Set some defaults
if not keywords.has_key("width"): keywords["width"]=24
#if not keywords.has_key("height"): keywords["height"]=20
if not keywords.has_key("bg"): keywords["bg"]="white"
if not keywords.has_key("relief"): keywords["relief"]="sunken"
Frame.__init__(self, master)
self.config(bg=keywords["bg"])
# Scrollbars
scrollbar = Scrollbar(self, orient=VERTICAL)
# Create the Text wgt
self.text=Text(self, yscrollcommand=scrollbar.set, **keywords)
scrollbar.config(command=self.text.yview)
scrollbar.pack(side=RIGHT, fill=Y)
self.text.pack(side=LEFT, fill=BOTH, expand=True)
self.scroll=scrollbar
tk = Tk()
st=ScrolledText(tk)
st.pack(expand=True, fill=BOTH)
st.text.insert(END, "Buttons:\n")
b1=Button(st.text, text="Hello 1")
st.text.window_create(END, window=b1)
st.text.insert(END, "\n")
b2=Button(st.text, text="Hello 2")
st.text.window_create(END, window=b2)
tk.mainloop()
On Thu, Nov 25, 2010 at 12:30 AM, Sorin Schwimmer <[email protected]> wrote:
> Mick, you're right, Tkinter frames are not scrollable. That's why I'm nesting
> my frame into a Text widget... and am not getting anywhere :-(
>
> SxN
>
>
> _______________________________________________
> Tkinter-discuss mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss