'Returns the next completion for txt, or None if there is no
completion.'

def complete(self, txt):

    path = os.path.expanduser(txt)
    if (not self.lookup):
        if (not self._testing):
            self.lookup = []
            if os.path.isdir(path):
                files = glob.glob(os.path.join(path, '*'))
                prefix = txt
            else:
                files = glob.glob((path + '*'))
                prefix = os.path.dirname(txt)
            prefix = (prefix or './')
            for f in files:
                display = os.path.join(prefix, os.path.basename(f))
                if os.path.isdir(f):
                    display += '/'
                self.lookup.append((display, f))
        if (not self.lookup):
            self.final = path
            return path
        self.lookup.sort()
        self.offset = (-1)
        self.lookup.append((txt, txt))
    self.offset += 1
    if (self.offset >= len(self.lookup)):
        self.offset = 0
    ret = self.lookup[self.offset]
    self.final = ret[1]
    return ret[0]
