devil20 发表于 2017-4-25 06:00:56

Python tk-text scrollbar

  Text with ScrollBar
  #!/usr/bin/python
  from tkinter import *
  root = Tk()
s = Scrollbar(root)
T = Text(root)
  T.focus_set()
s.pack(side=RIGHT, fill=Y)
T.pack(side=LEFT, fill=Y)
s.config(command=T.yview)
T.config(yscrollcommand=s.set)
  for i in range(40):
   T.insert(END, "This is line %d\n" % i)
  root.mainloop()
页: [1]
查看完整版本: Python tk-text scrollbar