Tkinter: Text.dump() method, and questions

Andrew Kuchling akuchlin at mems-exchange.org
Tue Apr 10 14:24:31 EDT 2001


The .dump() method of the Text widget isn't implemented, and I need
it.  A first cut at it looks like this:

def dump(self, index1='1.0', index2=None):
    args = (self._w, 'dump', index1, index2)
    t = self.tk.call( args )
    t = self.tk.splitlist(t)
    # Group the flat list into triples
    L = []
    for i in range(len(t), 3):
        L.append( t[i:i+3] )

    return L

Now, there are several switches that can be supplied to the 'dump'
widget command: -all, -command, -mark, etc.  I can't figure out from
Tkinter.py how to handle them.  Is the ._options(cnf, kw) method the
right way?

Some other questions:

   * is there some other way to get the information that dump()
     provides?  I can't see how people have used tags and managed to
     live without dump(), but maybe most applications of Text widgets
     don't use tags at all.

   * How would I go about making parts of a Text widget read-only and
     uneditable?

   * And, has anyone written an HTML-editorish widget in either
     Tkinter or plain Tcl/Tk? (tkHTML seems to only handle HTML
     display, not editing.)  I suspect I'm reinventing the wheel to
     some degree.

--amk



More information about the Python-list mailing list