summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/ScrolledText.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-07-06 21:54:39 (GMT)
committerGuido van Rossum <guido@python.org>1994-07-06 21:54:39 (GMT)
commit460b6bb1920a718c2189e5e35ff6dac38ebd8224 (patch)
treecc58894569476bfbb10c5f9ba73dd5d819835524 /Lib/tkinter/ScrolledText.py
parent72cb020b19e82bb48bbd81f2db7348aca0033f4f (diff)
downloadcpython-460b6bb1920a718c2189e5e35ff6dac38ebd8224.zip
cpython-460b6bb1920a718c2189e5e35ff6dac38ebd8224.tar.gz
cpython-460b6bb1920a718c2189e5e35ff6dac38ebd8224.tar.bz2
Totally changed, now it is actually derived from Text
(This breaks something in MimeViewer.py, don't know what yet)
Diffstat (limited to 'Lib/tkinter/ScrolledText.py')
-rwxr-xr-xLib/tkinter/ScrolledText.py51
1 files changed, 20 insertions, 31 deletions
diff --git a/Lib/tkinter/ScrolledText.py b/Lib/tkinter/ScrolledText.py
index 4092d4f..2683696 100755
--- a/Lib/tkinter/ScrolledText.py
+++ b/Lib/tkinter/ScrolledText.py
@@ -7,40 +7,29 @@
# Configuration options are passed to the Text widget.
# A Frame widget is inserted between the master and the text, to hold
# the Scrollbar widget.
-# Most methods calls are passed to the Text widget; the pack command
-# is redirected to the Frame widget however.
+# Most methods calls are inherited from the Text widget; Pack methods
+# are redirected to the Frame widget however.
from Tkinter import *
+from Tkinter import _cnfmerge
-class ScrolledText(Pack, Place):
+class ScrolledText(Text):
def __init__(self, master=None, cnf={}):
+ cnf = _cnfmerge(cnf)
fcnf = {}
- self.frame = Frame(master, {})
- if cnf.has_key(Pack):
- self.frame.pack(cnf[Pack])
- del cnf[Pack]
- self.vbar = Scrollbar(self.frame, {})
- self.vbar.pack({'side': 'right', 'fill': 'y'})
+ for k in cnf.keys():
+ if type(k) == ClassType:
+ fcnf[k] = cnf[k]
+ del cnf[k]
+ self.frame = Frame(master, fcnf)
+ self.vbar = Scrollbar(self.frame, {
+ Pack: {'side': 'right', 'fill': 'y'}})
cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
- self.text = Text(self.frame, cnf)
- self.text['yscrollcommand'] = (self.vbar, 'set')
- self.vbar['command'] = (self.text, 'yview')
- self.insert = self.text.insert
- # XXX should do all Text methods...
- self.pack = self.frame.pack
- self.bind = self.text.bind
- self.forget = self.frame.forget
- self.delete = self.text.delete
- self.insert = self.text.insert
- self.index = self.text.index
- self.get = self.text.get
- self.mark_set = self.text.mark_set
- self.tag_add = self.text.tag_add
- self.tag_delete = self.text.tag_delete
- self.tag_remove = self.text.tag_remove
- self.tag_config = self.text.tag_config
- self.yview = self.text.yview
- self.yview_pickplace = self.text.yview_pickplace
- self.tk = master.tk
- def __str__(self):
- return str(self.frame)
+ Text.__init__(self, self.frame, cnf)
+ self['yscrollcommand'] = (self.vbar, 'set')
+ self.vbar['command'] = (self, 'yview')
+
+ # Copy Pack methods of self.frame -- hack!
+ for m in Pack.__dict__.keys():
+ if m[0] != '_' and m != 'config':
+ setattr(self, m, getattr(self.frame, m))
'>Jack Jansen2001-09-011-1/+5 * Add warning mode for classic division, almost exactly as specified inGuido van Rossum2001-08-312-0/+2 * Make the Py<type>_Check() macro use PyObject_TypeCheck().Guido van Rossum2001-08-303-3/+3 * Change the GC type flag since the API has changed. Allow types usingNeil Schemenauer2001-08-291-50/+66 * Change the GC type flag since the API has changed. Allow types usingNeil Schemenauer2001-08-291-6/+10 * Make frames a PyVarObject instead of a PyObject.Neil Schemenauer2001-08-291-2/+1 * SF bug [#456252] Python should never stomp on [u]intptr_t.Tim Peters2001-08-291-5/+14 * Make the PyXXX_Check() macros for the numeric types inheritance-aware.Guido van Rossum2001-08-294-4/+4 * PyString_FromFormat() and PyString_FromFormatV(): Largely ripped fromBarry Warsaw2001-08-241-0/+4 * Add decl of PySuper_Type; fixup comments for the two other types.Guido van Rossum2001-08-241-2/+3 * Add new built-in type 'getset' (PyGetSet_Type).Guido van Rossum2001-08-231-0/+3 * Introduce OverflowWarning -- to be issued when short int operationsGuido van Rossum2001-08-231-0/+1 * Merge changes from r22a2-branch back into trunk. Also, change patchBarry Warsaw2001-08-221-2/+2 * ceval, PyEval_MergeCompilerFlags: wasn't merging in theTim Peters2001-08-171-0/+2 * Patch #445762: Support --disable-unicodeMartin v. Löwis2001-08-174-0/+13 * - Get rid of obsolete #define PATCHLEVEL.Guido van Rossum2001-08-17