Text with ScrollBar : Text « GUI Tk « Python






Text with ScrollBar

Text with ScrollBar
 

import Tkinter

root = Tkinter.Tk()
s = Tkinter.Scrollbar(root)
T = Tkinter.Text(root)

T.focus_set()
s.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
T.pack(side=Tkinter.LEFT, fill=Tkinter.Y)
s.config(command=T.yview)
T.config(yscrollcommand=s.set)

for i in range(40): 
   T.insert(Tkinter.END, "This is line %d\n" % i)

Tkinter.mainloop()


           
         
  








Related examples in the same category

1.Draw textDraw text
2.Draw text with fontDraw text with font
3.Scrolled TextScrolled Text
4.Change color for tagsChange color for tags
5.Change font for TextChange font for Text
6.Add double click action to a TextAdd double click action to a Text
7.Insert String to a TextInsert String to a Text
8.Text properties: expand and fillText properties: expand and fill
9.Show a file in a text widget
10.Search string in TextSearch string in Text