2015-03-09 01:38:31 -06:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
|
|
|
|
|
2021-12-29 01:14:35 -07:00
|
|
|
# I think this file is unused?
|
|
|
|
|
|
|
|
|
2020-10-14 09:23:49 -06:00
|
|
|
import tkinter
|
|
|
|
import tkinter.constants
|
2015-03-09 01:38:31 -06:00
|
|
|
|
|
|
|
# basic scrolled text widget
|
2020-10-14 09:23:49 -06:00
|
|
|
class ScrolledText(tkinter.Text):
|
2015-03-09 01:38:31 -06:00
|
|
|
def __init__(self, master=None, **kw):
|
2020-10-14 09:23:49 -06:00
|
|
|
self.frame = tkinter.Frame(master)
|
|
|
|
self.vbar = tkinter.Scrollbar(self.frame)
|
|
|
|
self.vbar.pack(side=tkinter.constants.RIGHT, fill=tkinter.constants.Y)
|
2015-03-09 01:38:31 -06:00
|
|
|
kw.update({'yscrollcommand': self.vbar.set})
|
2020-10-14 09:23:49 -06:00
|
|
|
tkinter.Text.__init__(self, self.frame, **kw)
|
|
|
|
self.pack(side=tkinter.constants.LEFT, fill=tkinter.constants.BOTH, expand=True)
|
2015-03-09 01:38:31 -06:00
|
|
|
self.vbar['command'] = self.yview
|
|
|
|
# Copy geometry methods of self.frame without overriding Text
|
|
|
|
# methods = hack!
|
2020-10-14 09:23:49 -06:00
|
|
|
text_meths = list(vars(tkinter.Text).keys())
|
|
|
|
methods = list(vars(tkinter.Pack).keys()) + list(vars(tkinter.Grid).keys()) + list(vars(tkinter.Place).keys())
|
2015-03-09 01:38:31 -06:00
|
|
|
methods = set(methods).difference(text_meths)
|
|
|
|
for m in methods:
|
|
|
|
if m[0] != '_' and m != 'config' and m != 'configure':
|
|
|
|
setattr(self, m, getattr(self.frame, m))
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return str(self.frame)
|