#3018: tkinter demo fixes for py3k.
diff --git a/Demo/tkinter/guido/tkman.py b/Demo/tkinter/guido/tkman.py
index 4fc0488..c50258e 100755
--- a/Demo/tkinter/guido/tkman.py
+++ b/Demo/tkinter/guido/tkman.py
@@ -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 @@
             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 @@
             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 @@
                 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: