Search code examples
tkintertextmove

Using tkinter move my txt around to any locaiton


Typical use of insert from tkinter is:

text1.insert(5.5,'*')

I want to use:

for x in 10:
    text1.insert(5.x,'*')

but I get invalid syntax.


Solution

  • The index is just a string in the formation of line.character, so you can use string formatting:

    for x in range(10):
        text1.insert(f"5.{x}", "*")