[Tutor] Text.index()

prasad rao prasadaraon50 at gmail.com
Tue Jun 2 12:02:03 CEST 2009


Hello
 I created a gui app.I am finding it impossible to
use Text.insert().please some one give an example of using it.

def fshow():
    x=entry1.get()

    try:
      value1,value2=x.split(',')

      text.insert(len(myfiles(value1,value2)),myfiles(value1,value2))
    except:
        text.insert(len(myfiles(value1,value2)),myfiles(x))

>>> import example4
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Python26\example4.py", line 37, in fshow
    text.insert(len(myfiles(value1,value2)),myfiles(x))
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 3001, in insert
    self.tk.call((self._w, 'insert', index, chars) + args)
TclError: bad text index "178"

 import example4
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Python26\example4.py", line 37, in fshow
    text.insert(None,myfiles(x))
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 3001, in insert
    self.tk.call((self._w, 'insert', index, chars) + args)
TclError: wrong # args: should be ".18428952.18430232 insert index chars
?tagList chars tagList ...?"
I cant understand what these error messages are telling.

Thanking you

Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090602/033707f1/attachment.htm>


More information about the Tutor mailing list