In tkinter
library Tab puts +8 space into Text()
widget.
How do I change number of spaces?
My tkinter
code:
from tkinter import *
win = Tk()
txt = Text()
txt.pack()
win.mainloop()
.
In tkinter
library Tab puts +8 space into Text()
widget.
How do I change number of spaces?
My tkinter
code:
from tkinter import *
win = Tk()
txt = Text()
txt.pack()
win.mainloop()
.
I made this change to your code from Python/Tkinter: How to set text widget contents to the value of a variable?
from tkinter import *
win = Tk()
txt = Text()
txt.pack()
def tab(arg):
print("tab pressed")
txt.insert(INSERT, " " * 4) #this number is where you set the amount of spaces to add per tab
return 'break'
txt.bind("<Tab>", tab)
win.mainloop()