I know how to find the number of items. Just like you show.
No, this is not the size of the box. I have maybe 2000 entries. I can set
the current selection, etc with code like this:
self.lb.select_clear(ACTIVE) # needed to un-hilite existing selection
self.lb.activate(x) # make new item active
self.lb.see(x-10) # force display from 10 previous
self.lb.select_set(x) # and select the new item
If the listbox is 20 lines high, this works perfectly. But, if it is a
different size, it doesn't center. In my case I don't know the size of box,
so the "-10" is a not-to-intelligent guess.
On Tue, Feb 13, 2018 at 2:49 PM, Bhaskar Chaudhary <bha100...@gmail.com>
> Hi Bob
> Are you looking for the number of items in the listbox ?
> If yes this should give you the number of items.
> print(len(listbox.get(0, END)))
> Given that each item occupies one line in the list box, i think it the
> same as giving the height in lines.
> On 2/13/18, Bob van der Poel <b...@mellowood.ca> wrote:
> > Is there a way to get the current height (hopefully in lines) of a
> > I'd like to center, vertically, the result of a search.
> > --
> > **** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
> > Bob van der Poel ** Wynndel, British Columbia, CANADA **
> > EMAIL: b...@mellowood.ca
> > WWW: http://www.mellowood.ca
**** Listen to my FREE CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
Tkinter-discuss mailing list