problem adding a scrollbar to a text widget

C

Chris Hare

Here is my chunk of code. I can't figure out what I am doing wrong to put my scrollbar on the right hand side of the text box.

from Tkinter import *

def showLogFile():
top = Toplevel()
f = Frame(top, bd=0, bg="Gray")
top.title = "netcomm log file"
f.grid()
sc = Scrollbar(top)
sc.grid()
t = Text(f, yscrollcommand = sc.set)
sc.config(command=t.yview)
t.insert(END,"This is a line of text")
t.config(height=20,width=80,bg="Gray")
button = Button(f, text="Dismiss", command=top.destroy, highlightbackground="Red")
t.grid()
button.grid()


showLogFile()
mainloop()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top