'Should be called when the selection of the Listbox has changed.
Updates the Listbox display and calls _change_start.'

def _selection_changed(self):

    cursel = int(self.listbox.curselection()[0])
    self.listbox.see(cursel)
    lts = self.lasttypedstart
    selstart = self.completions[cursel]
    if (self._binary_search(lts) == cursel):
        newstart = lts
    else:
        min_len = min(len(lts), len(selstart))
        i = 0
        while ((i < min_len) and (lts[i] == selstart[i])):
            i += 1
        newstart = selstart[:i]
    self._change_start(newstart)
    if (self.completions[cursel][:len(self.start)] == self.start):
        self.listbox.configure(selectbackground=self.origselbackground, selectforeground=self.origselforeground)
    else:
        self.listbox.configure(selectbackground=self.listbox.cget('bg'), selectforeground=self.listbox.cget('fg'))
        if self.morecompletions:
            self.completions = self.morecompletions
            self.morecompletions = None
            self.listbox.delete(0, END)
            for item in self.completions:
                self.listbox.insert(END, item)
            self.listbox.select_set(self._binary_search(self.start))
            self._selection_changed()
