On Wed, 14 Feb 2018 00:32:09 +0100 Michael Lange <klappn...@web.de> wrote:
(...) > I guess > this simple function is certainly not perfect (but maybe it is already > good enough): um, maybe that test() function should be slightly changed, like this (although yview() does not seem to complain about negative indices): def test(event): i = 597 wd = event.widget wd.selection_clear(0, 'end') wd.selection_set(i) wd.update_idletasks() h1 = wd.winfo_height() i1, i2 = wd.nearest(0), wd.nearest(h1) index = i - (i2-i1)/2 if index < 0: index = 0 wd.yview(index) Best regards Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. It is necessary to have purpose. -- Alice #1, "I, Mudd", stardate 4513.3 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org https://mail.python.org/mailman/listinfo/tkinter-discuss