#3018: tkinter demo fixes for py3k.

This commit is contained in:
Georg Brandl 2010-10-25 17:50:20 +00:00
parent 07e4f1565b
commit 856023a098
18 changed files with 196 additions and 179 deletions

View file

@ -2,11 +2,11 @@
# Tk man page browser -- currently only shows the Tcl/Tk man pages
import sys
import os
import string
import re
import sys
from tkinter import *
from ManPage import ManPage
MANNDIRLIST = ['/depot/sundry/man/mann','/usr/local/man/mann']
@ -221,9 +221,9 @@ class SelectionBox:
print('Regex error:', msg)
return
here = self.text.index(AtInsert())
lineno = string.atoi(here[:string.find(here, '.')])
lineno = int(here[:here.find('.')])
end = self.text.index(AtEnd())
endlineno = string.atoi(end[:string.find(end, '.')])
endlineno = int(end[:end.find('.')])
wraplineno = lineno
found = 0
while 1:
@ -237,9 +237,9 @@ class SelectionBox:
line = self.text.get('%d.0 linestart' % lineno,
'%d.0 lineend' % lineno)
i = prog.search(line)
if i >= 0:
if i:
found = 1
n = max(1, len(prog.group(0)))
n = max(1, len(i.group(0)))
try:
self.text.tag_remove('sel',
AtSelFirst(),
@ -247,10 +247,10 @@ class SelectionBox:
except TclError:
pass
self.text.tag_add('sel',
'%d.%d' % (lineno, i),
'%d.%d' % (lineno, i+n))
'%d.%d' % (lineno, i.start()),
'%d.%d' % (lineno, i.start()+n))
self.text.mark_set(AtInsert(),
'%d.%d' % (lineno, i))
'%d.%d' % (lineno, i.start()))
self.text.yview_pickplace(AtInsert())
break
if not found: