Hi,

On Wed, 27 Feb 2013 14:35:11 -0800
Lion Kimbro <lionkim...@gmail.com> wrote:

> Perhaps use window coordinates?
> 
> There's a way of indexing with "@x,y" that might work.
> 
> http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-index.html
> https://www.tcl.tk/man/tcl8.4/TkCmd/text.htm#M20

yes, something like this might do the trick:

from Tkinter import *
from ScrolledText import ScrolledText

root = Tk()
text = ScrolledText(root)
text.pack(side='left', fill='both', expand=1)
f = open('/etc/fstab', 'r')
text.insert('end',f.read())
f.close()

def test(ev):
    y0, y1 = text.yview()
    print text.index('@0,%d' % y0)

root.bind('<F1>', test)
root.mainloop()

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Even historians fail to learn from history -- they repeat the same
mistakes.
                -- John Gill, "Patterns of Force", stardate 2534.7
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to