tkinter - label widget text selection

rahulnag22 at yahoo.com rahulnag22 at yahoo.com
Tue May 8 11:34:48 EDT 2007


On May 6, 2:24 pm, Rob Wolfe <r... at smsnet.pl> wrote:
> rahulna... at yahoo.com writes:
> > Hi,
> > I guess this is a very trivial question --
> > I am using a label widget to display text (black font in a white
> > background color). I am trying to use my mouse to scroll over the
> > displayed text to select it, buttkinterdoes not allow me to do it.
> > Is there a method/option to do this.
>
> Try to use an entry widget in read-only state:
>
> <code>
> importTkinteras Tk
> root = Tk.Tk()
>
> ent = Tk.Entry(root, state='readonly', readonlybackground='white', fg='black')
> var = Tk.StringVar()
> var.set('Some text')
> ent.config(textvariable=var, relief='flat')
> ent.pack()
> root.mainloop()
> </code>
>
> --
> HTH,
> Rob

Thanks Rob I will try it out...Rahul




More information about the Python-list mailing list