[Tutor] Scrolling multilistbox help

jfouhy@paradise.net.nz jfouhy at paradise.net.nz
Tue Jul 19 00:30:31 CEST 2005


Quoting Alberto Troiano <albertito_g at hotmail.com>:

> I'm using the Multilistbox class and I noticed that it only handles the
> mouse scroll and the scrollbar to go down or up.I succesfully
> implemented the sort function that came with the class
> I also added code to handle the up and down arrow keys and it goes down
> all right but only select the item and it doesn't scroll down or up
> How can make it go up or down?

I haven't actually tried your code, but this might be the problem here:

>  def _select1(self):
>  if self.fila==self.size()-1:
>  pass
>  else:
>  self.selection_clear(0, END)
>  	 self.selection_set(self.fila+1)
>  self.fila+=1
>  self._scroll()
> 	return 'break'
>
>  def _scroll(self, *args):
> 	for l in self.lists:
> 	 apply(l.yview, args)

You call self._scroll with no arguments to make the selected index visible (I
guess).  But self._scroll just calls yview on each list..and yview with no
arguments returns a tuple, but otherwise does nothing.

Try replacing self._scroll with self.see --- possibly: self.see(self.fila).

-- 
John.


More information about the Tutor mailing list