By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,215 Members | 1,005 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,215 IT Pros & Developers. It's quick & easy.

tkinter - label widget text selection

P: n/a
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, but tkinter does not allow me to do it.
Is there a method/option to do this.
Thanks
Rahul

May 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ra********@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, but tkinter does 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>
import Tkinter as 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
May 6 '07 #2

P: n/a
On May 6, 2:24 pm, Rob Wolfe <r...@smsnet.plwrote:
rahulna...@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

May 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.