[Tkinter-discuss] Possible to create separator lines in a Tkinter Listbox?

Wayne Werner waynejwerner at gmail.com
Thu Nov 11 00:24:10 CET 2010


On Wed, Nov 10, 2010 at 7:44 AM, <python at bdurham.com> wrote:

> How can I create non-selectable horizontal separator items in a Listbox,
> eg. separators equivalent to the Tkinter Menu widget's .add_separator()?
> Using chars like dashes and underscores looks awful.
>
> If this functionality is not possible, does anyone have a recommendation on
> a Unicode char similar to an underscore, but vertically centered, that I
> might use as a char based separator?
>

unichr(8213)  looks pretty good. I'm not sure if your original desire is
possible, but you could make it non-selectable by binding <<ListboxSelect>>
. You'd do something like this:

1. Is current selection one of the separators?
2. If not, OK
3. If so, change selection to the previous item

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101110/24a66ae9/attachment.html>


More information about the Tkinter-discuss mailing list