This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: print(text1.get(1.2,1.5))
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: mlwtc, serhiy.storchaka, steven.daprano
Priority: normal Keywords:

Created on 2020-02-02 05:22 by mlwtc, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg361212 - (view) Author: (mlwtc) Date: 2020-02-02 05:22
>>> from tkinter import *
>>> root = Tk()
>>> text1 = Text(root,width=30,height=3)
>>> text1.insert(INSERT,'abcdefghijklmnopqrstuvwxyz123456789123456789')
>>> print(text1.get(1.0,1.30))
abc
>>> print(text1.get(1.0,1.31))
abcdefghijklmnopqrstuvwxyz12345
>>> print(text1.get(1.0,1.20))
ab
>>> print(text1.get(1.0,1.21))
abcdefghijklmnopqrstu
>>> print(text1.get(1.0,1.10))
a
>>> print(text1.get(1.0,1.11))
abcdefghijk
>>> print(text1.get(1.0,1.9))
abcdefghi
  

   Is there a bug here?
msg361216 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-02-02 05:45
> Is there a bug here?

How about if you tell us what behaviour you expected, why you expected it, and what you got instead, then we can tell you if your expectation was correct and whether or not there is a bug.

You have seven results printed. I have no idea which ones you think are wrong.
msg361218 - (view) Author: (mlwtc) Date: 2020-02-02 06:02
Look at line 5:print(text1.get(1.0,1.30))
I think the result should be "abcdefghijklmnopqrstuvwxyz1234"

print(text1.get(1.0,1.20))
I think the result should be "abcdefghijklmnopqrst"

print(text1.get(1.0,1.10))
I think the result should be "abcdefghij"

     Others are correct,So I don't know why these results are not my expected.
msg361223 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-02-02 08:00
1.30 is the same as 1.3 in Python.

You perhaps want to use '1.30'.
msg361226 - (view) Author: (mlwtc) Date: 2020-02-02 10:13
ok, I see, Thank U.
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83707
2020-02-02 10:19:53SilentGhostsetstatus: open -> closed
resolution: not a bug
stage: resolved
2020-02-02 10:13:41mlwtcsetmessages: + msg361226
2020-02-02 08:00:12serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg361223
2020-02-02 06:02:25mlwtcsetmessages: + msg361218
2020-02-02 05:45:26steven.dapranosetnosy: + steven.daprano
messages: + msg361216

components: + Tkinter, - Build
type: compile error -> behavior
2020-02-02 05:22:38mlwtccreate