Text widget incorrect 'displaylines' count

Alexander Uvizhev <[email protected]>
Newsgroups gmane.comp.python.tkinter
Message-ID <[email protected]>
Hi,
Recently I came across some strangeness in tkinter Text widget. I bind <Configure> event to it and the first time I insert text into widget the callback is called and reports wrong 'displaylines' count.
Here is the code:
===
$ cat test_text.py
import tkinter


def check(event):
    lines = event.widget.count('1.0', 'end', 'displaylines')
    print(lines)

root = tkinter.Tk()
master = tkinter.Frame(master=root)
master.grid()
text = tkinter.Text(master=master, height=1)
text.bind('<Configure>', check)
text.grid()
text.insert('1.0', "1234567890")  # first time insert
text.insert('1.0', "1234567890")  # second
text.unbind('<Configure>')
master.mainloop()
===
Output:
$ python3 test_text.py 
(10,)

Is it what's supposed to be or some sort of bug?

-- 
Alexander Uvizhev
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.