Let's say your text widget is .frame1.text1.
The statement: .frame1.text1 index end will return the location of the last insertion (including a linefeed if that were the last "character") in the form, line.char. Split the returned string on "." and the 0th element is the line number.
.text -width n -height n -font {name n}
pack .text
set astring "my string"
set lastline [lindex [split [.text index end] .] 0]
if {[expr $lastline % 26] == 0} {
.text insert end $astring
}
Now I would like the string to start with a tab, but
.text -width n -height n -font {name n} -tab n
etc...
set astring "\tmy string"
etc...
displays "\t" as the default 8 character tab. Am I missing something?
I don't know of a "-tab" option in the text widget. There is a "-tabs" option but the syntax there is for a number of centimeters or inches. Assuming you meant -tabs $n, and the units default, I don't know why it isn't working. Try instantiating the text widget without specifying the tab spacing. If that doesn't work try this: set astring \t
append astring "my string"
I don't know what it means if it works or even if it doesn't.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.