Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multi-column listboxes in Tkinter

1,197 views
Skip to first unread message

pbo...@aisws7.cern.ch

unread,
Jan 21, 1998, 3:00:00 AM1/21/98
to

I am not sure whether there has been a big demand for a
listbox with multiple columns for use with Tkinter, although
I recall a posting some time ago requesting information about
a Windows-style widget which sounded a bit similar.

I have been surprised by the absence of such an object, and
not wanting to build extensions to Tk I was motivated to
write something myself, if only to demonstrate the concept.

It can be found at:

http://assuwww.cern.ch/~pboddie/Personal/Interests/Python/TkinterTable.html

I hope that this is at least of interest to those wanting
some more advanced listbox behaviour.

--
Paul Boddie Paul....@cern.ch
------------------------------------------------------------
http://assuwww.cern.ch/~pboddie

David M. Cook

unread,
Jan 21, 1998, 3:00:00 AM1/21/98
to

On 21 Jan 1998 13:38:30 GMT, pbo...@aisws7.cern.ch <pbo...@aisws7.cern.ch>
wrote:

>I am not sure whether there has been a big demand for a
>listbox with multiple columns for use with Tkinter, although

Yes, this is great, just in time for a little database app I was working on.

Would you consider making this a Pmw megawidget? See

http://www.dscpl.com.au/pmw/

Dave Cook

pbo...@aisws7.cern.ch

unread,
Jan 22, 1998, 3:00:00 AM1/22/98
to

David M. Cook (dmc...@cts.com) wrote:
: On 21 Jan 1998 13:38:30 GMT, pbo...@aisws7.cern.ch <pbo...@aisws7.cern.ch>
: wrote:

: http://www.dscpl.com.au/pmw/

Well, it's all about time, really. I hope to get around to
providing methods to delete rows and cells, and to insert
rows and cells at any place in the table. That would make
it a bit more flexible than it is at the moment. ;-)

After that, Pmw would be the next step, I suppose. Having
said all this, if anyone wants to have a hack around with
the code then by all means feel free.

Roey Katz

unread,
Jan 22, 1998, 3:00:00 AM1/22/98
to

I've written a preliminary PMW table widget.
Among other features, it has sortable headers.

it's available at
http://www.eeel.nist.gov/~katz/PMW/HeaderedListBox.py

- Roey
ik...@erols.com


disclaimer: Neither I nor NIST will be held accountable for potential
losses as a result of runing said module.

pbo...@aisws7.cern.ch

unread,
Jan 23, 1998, 3:00:00 AM1/23/98
to

Roey Katz (ik...@erols.com) wrote:
: I've written a preliminary PMW table widget.

: Among other features, it has sortable headers.

I like it. And it looks like you have been able to get much
of the functionality I was looking for from the use of standard
listboxes. I had to change the import of Pmw to work with the
version I am using (Pmw 0.5), but it works fine! Nice one.

Clemens Hintze

unread,
Jan 23, 1998, 3:00:00 AM1/23/98
to

Hello Roey,

good work!

I can answer one question which you have ask in your .py file. For the
other two, I cannot understand what you want to know. Sorry!

1. You may use the option highlightthickness=0 for Tkinter.Buttons and
Tkinter.Listbox. Now the widgets should touch each other.

2. What do you mean with pady=1 does not work? I have tried to put
pady=10 for Tkinter.Button (your headers) and it works properly.

3. I do not understand this question too. What is the purpose of that
behavior (the header buttons take up only the space they need)? How
should the HeaderList looks like if they would do it?


Bye,
Cle.


Roey Katz wrote:
>
> I've written a preliminary PMW table widget.
> Among other features, it has sortable headers.
>
> it's available at
> http://www.eeel.nist.gov/~katz/PMW/HeaderedListBox.py
>

> - Roey
> ik...@erols.com
>
> disclaimer: Neither I nor NIST will be held accountable for potential
> losses as a result of runing said module.

--
| Clemens Hintze * ACB/EO ____ OMC-R Software Developement
| Phone: +49 30 7002-3241 \ / ALCATEL Mobile Communication Division
ITD
| Fax : +49 30 7002-3851 \/ Colditzstr. 34-36, D-12099 Berlin,
Germany
| mailto:Clemens...@bln.sel.alcatel.de

Roey Katz

unread,
Jan 24, 1998, 3:00:00 AM1/24/98
to

>1. You may use the option highlightthickness=0 for Tkinter.Buttons and
>Tkinter.Listbox. Now the widgets should touch each other.
Done! thanks :) (I love it when I can fix something so easily).

>2. What do you mean with pady=1 does not work? I have tried to put
>pady=10 for Tkinter.Button (your headers) and it works properly.

Well, what I'm aiming for is for the header buttons to be only as tall
as the button label text is; i.e., I don't want any vertical padding
between the text and the edge of the button. Maybe I'm being too
picky? or maybe space-conservative? pady=100 works, but there appears
to be a 'minimum' pady which I can't override.

>3. I do not understand this question too. What is the purpose of that
>behavior (the header buttons take up only the space they need)? How
>should the HeaderList looks like if they would do it?

What I meant to ask was: 'why are all the header buttons all the same
width?'. Why can't I simply set the width of the header button to be
equal to the width of the widest item in that header's listbox? I
hope Tk automatically resizes listboxes for me.

There are other problems: the sorting routine is still slow.
Re-populating the listboxes takes forever, especially on my 486-66
(six to ten seconds). And I have a few problems with multiple
selection; if you grab a listbox item and drag it down, only the
listbox in which the item is contained will scroll, and the other
listboxes will stay the same.
Greg McFarlane (PMW maintainer) and I exchanged a few mails -- he
suggested that in order to accomodate things such as
resizable/relocateable columns and pixmap support (for example, a
checkmark or a lightning symbol to indicate a download in session),
grid() would have to replace the listboxes. He fixed a number of
things for me (thanks Greg!!) involving the packing (ihe changed
pack() to grid(), for example, making the design much cleaner).
I agree with all of you (Paul especially) that I'm stretching the
use of a Tk listbox.


Roey Katz
ik...@erols.com

(updated) HeaderedListBox.py (PMW module) available at:
http://bolt.eeel.nist.gov/~katz/PMW/HeaderedListBox.py

Greg McFarlane

unread,
Jan 26, 1998, 3:00:00 AM1/26/98
to

On 24 Jan, Roey Katz wrote:
> >2. What do you mean with pady=1 does not work? I have tried to put
> >pady=10 for Tkinter.Button (your headers) and it works properly.
> Well, what I'm aiming for is for the header buttons to be only as tall
> as the button label text is; i.e., I don't want any vertical padding
> between the text and the edge of the button. Maybe I'm being too
> picky? or maybe space-conservative? pady=100 works, but there appears
> to be a 'minimum' pady which I can't override.

I think all you are seeing here is a bit of space for the bottom of
letters like g, j, p, q and y. It just so happens that none of your
example headers contain any of these letters. There is a name for the
bits that stick out above and bellow letters, but I forget what it is.
In any case, Tk will not let you get rid of this space in buttons,
labels, etc.

--
Greg McFarlane
INMS Telstra Australia (gr...@iname.com)

Jim Kraai

unread,
Jan 26, 1998, 3:00:00 AM1/26/98
to

> From: Greg McFarlane <gr...@iname.com>
> Subject: Re: Multi-column listboxes in Tkinter
> Date: Mon, 26 Jan 1998 19:23:41 +1100
> To: Roey Katz <ik...@erols.com>
> Cc: pytho...@cwi.nl

>On 24 Jan, Roey Katz wrote:
>[...]

>I think all you are seeing here is a bit of space for the bottom of
>letters like g, j, p, q and y. It just so happens that none of your
>example headers contain any of these letters. There is a name for the
>bits that stick out above and bellow letters, but I forget what it is.
>[...]

descenders

0 new messages