problem adding a scrollbar to a text widget

Discussion in 'Python' started by Chris Hare, Aug 4, 2010.

  1. Chris Hare

    Chris Hare Guest

    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()
    Chris Hare, Aug 4, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex

    ScrollBar? Does it exist just WEB ScrollBar Control?

    Alex, Apr 1, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    264
    Alvin Bruney [MVP]
    Apr 4, 2004
  2. Chris
    Replies:
    1
    Views:
    155
    Chris
    Feb 27, 2009
  3. Replies:
    0
    Views:
    331
  4. Frederic Rentsch
    Replies:
    0
    Views:
    234
    Frederic Rentsch
    Jul 8, 2012
  5. Terry Reedy
    Replies:
    15
    Views:
    630
    Frederic Rentsch
    Jul 16, 2012
Loading...

Share This Page