Polling selections from a listbox (Tkinter)

Eric Brunel eric_brunel at despammed.com
Mon Feb 28 06:27:28 EST 2005


On 26 Feb 2005 03:48:16 -0800, Harlin Seritt <harlinseritt at yahoo.com> wrote:
[snip]
> Obviously when this starts up this is going to show selection #0 inside
> the label box. How do I make sure that whatever is arbitrarily selected
> ends up in the label box as this gui runs? I tried doing a bind:
>
> self.listbox.bind("<Button-1>", self.changelabel)
>
> This did not work as intended as the changelabel's text option only
> showed what the selection index was BEFORE the event took place.

Bind on <ButtonRelease-1>; <Button-1> is a synonym for <ButtonPress-1>, and when the button is pressed, the selection is not done yet.

HTH
-- 
python -c 'print "".join([chr(154 - ord(c)) for c in "U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-"])'



More information about the Python-list mailing list