Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25501 > unrolled thread

How to configure Tkinter Listbox to disable state keeping selected item highlighted

Started bySarbjit singh <sarbjit1987@gmail.com>
First post2012-07-17 06:55 -0700
Last post2012-07-18 16:47 -0700
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  How to configure Tkinter Listbox to disable state keeping selected item highlighted Sarbjit singh <sarbjit1987@gmail.com> - 2012-07-17 06:55 -0700
    Re: How to configure Tkinter Listbox to disable state keeping selected item highlighted Rick Johnson <rantingrickjohnson@gmail.com> - 2012-07-18 16:47 -0700

#25501 — How to configure Tkinter Listbox to disable state keeping selected item highlighted

FromSarbjit singh <sarbjit1987@gmail.com>
Date2012-07-17 06:55 -0700
SubjectHow to configure Tkinter Listbox to disable state keeping selected item highlighted
Message-ID<92bf377d-05ea-42f8-98e4-3d76114aebc9@googlegroups.com>

I am having a problem configuring a listbox widget such that the selection remains highlighted even while it is set (programmatically) to the DISABLED state. Below code shows the problem:

from Tkinter import *
master = Tk()
listbox = Listbox(master)
listbox.pack()
listbox.insert(END, "Text1")
listbox.insert(END, "Text2")
listbox.insert(END, "Text3")
listbox.selection_set(first=0, last=None)
listbox.configure(exportselection=False)
listbox.configure(state=DISABLED)

Now when I change state to NORMAL, selected item is being highlighted. Is there a way I could disable widget (i.e. No response on mouse clicks) but keep the selected object remain highlighted?

Intent: I want to utilise this widget on wizard App that I am creating. I would like this widget to indicate the current page / wizard number which the user selected. Is there any other widget I could use instead of it? (Labels possibly?)

[toc] | [next] | [standalone]


#25593

FromRick Johnson <rantingrickjohnson@gmail.com>
Date2012-07-18 16:47 -0700
Message-ID<19fa8023-baba-446f-93ae-08e99cdadf50@googlegroups.com>
In reply to#25501
On Tuesday, July 17, 2012 8:55:21 AM UTC-5, Sarbjit singh wrote:
> I am having a problem configuring a listbox widget such that the selection remains highlighted even while it is set (programmatically) to the DISABLED state. Below code shows the problem:
> 
> from Tkinter import *
> master = Tk()
> listbox = Listbox(master)
> listbox.pack()
> listbox.insert(END, &quot;Text1&quot;)
> listbox.insert(END, &quot;Text2&quot;)
> listbox.insert(END, &quot;Text3&quot;)
> listbox.selection_set(first=0, last=None)
> listbox.configure(exportselection=False)
> listbox.configure(state=DISABLED)
> 
> Now when I change state to NORMAL, selected item is being highlighted. Is there a way I could disable widget (i.e. No response on mouse clicks) but keep the selected object remain highlighted?
> 
> Intent: I want to utilise this widget on wizard App that I am creating. I would like this widget to indicate the current page / wizard number which the user selected. Is there any other widget I could use instead of it? (Labels possibly?)



On Tuesday, July 17, 2012 8:55:21 AM UTC-5, Sarbjit singh wrote:
> I am having a problem configuring a listbox widget such that the selection remains highlighted even while it is set (programmatically) to the DISABLED state. Below code shows the problem:
> 
> from Tkinter import *
> master = Tk()
> listbox = Listbox(master)
> listbox.pack()
> listbox.insert(END, &quot;Text1&quot;)
> listbox.insert(END, &quot;Text2&quot;)
> listbox.insert(END, &quot;Text3&quot;)
> listbox.selection_set(first=0, last=None)
> listbox.configure(exportselection=False)
> listbox.configure(state=DISABLED)
> 
> Now when I change state to NORMAL, selected item is being highlighted. Is there a way I could disable widget (i.e. No response on mouse clicks) but keep the selected object remain highlighted?
> 
> Intent: I want to utilise this widget on wizard App that I am creating. I would like this widget to indicate the current page / wizard number which the user selected. Is there any other widget I could use instead of it? (Labels possibly?)

What's wrong with a page number displayed on a label? Why must you insist on displaying every page number in a Listbox? That seems like a waste of resources to me. You could even say: "Showing page I of N".

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web