1 """Sample taken from: http://www.tkdocs.com/tutorial/morewidgets.html and 2 converted to Python, mainly to demonstrate xscrollcommand option. 3 4 grid [tk::listbox .l -yscrollcommand ".s set" -height 5] -column 0 -row 0 -sticky nwes 5 grid [ttk::scrollbar .s -command ".l yview" -orient vertical] -column 1 -row 0 -sticky ns 6 grid [ttk::label .stat -text "Status message here" -anchor w] -column 0 -row 1 -sticky we 7 grid [ttk::sizegrip .sz] -column 1 -row 1 -sticky se 8 grid columnconfigure . 0 -weight 1; grid rowconfigure . 0 -weight 1 9 for {set i 0} {$i<100} {incr i} { 10 .l insert end "Line $i of 100" 11 } 12 """ 13 import Tkinter 14 import ttk 15 16 root = Tkinter.Tk() 17 18 l = Tkinter.Listbox(height=5) 19 l.grid(column=0, row=0, sticky='nwes') 20 21 s = ttk.Scrollbar(command=l.yview, orient='vertical') 22 l['yscrollcommand'] = s.set 23 s.grid(column=1, row=0, sticky="ns") 24 25 stat = ttk.Label(text="Status message here", anchor='w') 26 stat.grid(column=0, row=1, sticky='we') 27 28 sz = ttk.Sizegrip() 29 sz.grid(column=1, row=1, sticky='se') 30 31 root.grid_columnconfigure(0, weight=1) 32 root.grid_rowconfigure(0, weight=1) 33 34 for i in range(100): 35 l.insert('end', "Line %d of 100" % i) 36 37 root.mainloop() 38