hi all,
i have little method for parsing line in tkinter.Text.
text.bind(‘<Return>’, parse)
def parse(event=None):
text = get_current_line() # this give
me whole text on line
pattern = r”^.*define\s<?P<defkeyword>.*):$” # simple search pattern
reg = re.compile(pattern, re.S|re.M) # for use with more
patterns
match = re.search(reg, text)
if match:
print(‘found %s definition.’ % match.group(‘defkeyword’))
text.insert(‘end’, ‘\n’)
text.insert(‘insert linestart’, ‘\t’)
there is small problem for me. how to insert tab into newline without next ‘\n’
?
i want only 2 lines not 3.
i want:
1. define some:
2. .......[next insert will be here]
and not:
1. define some:
2. .......
3. [now ‘end’ points here]
and second how i define width of tab in chars not in pixels using
text.config(tabs=X)
thanks.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss