Thanks Micheal! I am going to save the "number of lines" snippet for future
reference.
Best,
On Wed, Feb 14, 2018 at 3:42 PM, Michael Lange wrote:
> Hi,
>
> On Tue, 13 Feb 2018 17:11:47 -0700
> Bob van der Poel wrote:
>
> > Getting closer :)
> >
> > I
Hi,
On Tue, 13 Feb 2018 17:11:47 -0700
Bob van der Poel wrote:
> Getting closer :)
>
> I asked the question wrongly. I need to determine the number of VISIBLE
> lines in the listbox.
Should be (as used in my previous example)
visible_lines =
Getting closer :)
I asked the question wrongly. I need to determine the number of VISIBLE
lines in the listbox.
Using the .winfo_height() does return the height in pixels. Note: You do
have to make the widget visible before doing this, otherwise you just get
"1" returned. widget.update() works
On Wed, 14 Feb 2018 00:32:09 +0100
Michael Lange wrote:
(...)
> I guess
> this simple function is certainly not perfect (but maybe it is already
> good enough):
um, maybe that test() function should be slightly changed, like this
(although yview() does not seem to complain
On Tue, 13 Feb 2018 17:19:44 -0600
Bryan Oakley wrote:
(...)
> Another trick would be to get the index of the item at the 0th pixel
> location of the widget (eg: the_listbox.index("@0,0"), and another at
> the pixel location for the height of the widget (ie: by using the
Hi,
On Wed, 14 Feb 2018 03:19:29 +0530
Bhaskar Chaudhary wrote:
> 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
Hi,
On Tue, 13 Feb 2018 17:09:30 -0600
Bryan Oakley wrote:
> The actual height of any widget can be obtained with the winfo_height
> method. It returns the value in pixels. To get the height in number of
> lines you'll have to compute the height of your font and do a
Hi,
On Tue, 13 Feb 2018 15:36:55 -0700
Bob van der Poel wrote:
> 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:
>
>
If your actual goal is to scroll the listbox so that an item is centered,
you can first scroll the item as far as possible and then call the "see"
method. For example, if the result is in the first half of the items,
scroll all the way down (listbox.yview("end")). If it's in the second half,
The actual height of any widget can be obtained with the winfo_height
method. It returns the value in pixels. To get the height in number of
lines you'll have to compute the height of your font and do a little math.
On Tue, Feb 13, 2018 at 12:11 PM, Bob van der Poel wrote:
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)
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.
regards
Bhaskar
On 2/13/18, Bob van der
Is there a way to get the current height (hopefully in lines) of a listbox?
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:
13 matches
Mail list logo