[Tutor] gui tks and encodings

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Jun 2 15:02:51 EDT 2004


> >But if you insert some characters and move the insert into the
> >middle of them, then you should get a different result. "
>
> yes i know i should, but i don't. the widget is full of characters
> and i move the cursor to the middle, this has always been the way i
tried.

>>> tk = Tk()
>>> t = Text()
>>> t.pack()
>>> def printBbox():
...    print 'bbox returned: ', t.bbox(INSERT)
...
>>> b = Button(text="BBOX", command = printBbox)
>>> b.pack()
>>> tk.mainloop()
bbox returned:  (3, 3, 480, 13)
bbox returned:  (61, 3, 6, 13)
bbox returned:  (92, 29, 6, 13)
bbox returned:  (260, 3, 6, 13)


Seems to work OK for me.

Alan G.




More information about the Tutor mailing list