Checkbuttons in a Text widget

L

Lou G

I'm trying to show a number of Checkbuttons (each with associated text
based on a list of names) inside a y-scrollable Text widget like so:

[ ] Bob
[ ] Carol
[ ] Ted
[ ] Alice
etc.
etc.

There may be quite a few (as many as 100 or so). I'm uncertain as to
the correct way to get these into the Text widget. I've tried
text.insert and it doesn't seem to do the job. Help?

Thanks,
Lou G
 
B

bruno at modulix

Lou said:
I'm trying to show a number of Checkbuttons (each with associated text
based on a list of names) inside a y-scrollable Text widget like so:

[ ] Bob
[ ] Carol
[ ] Ted
[ ] Alice
etc.
etc.

I really doubt there's a GUI toolkit supporting such a 'feature'. As
it's name implies, a TextBox is meant to edit *text*.

I suppose what you need is a scrollable widget allowing multiple
selection. In most GUI toolkits I'v seen, this is usually done with a
Grid (ie table) widget.
 
D

Diez B. Roggisch

Lou said:
I'm trying to show a number of Checkbuttons (each with associated text
based on a list of names) inside a y-scrollable Text widget like so:

[ ] Bob
[ ] Carol
[ ] Ted
[ ] Alice
etc.
etc.

There may be quite a few (as many as 100 or so). I'm uncertain as to
the correct way to get these into the Text widget. I've tried
text.insert and it doesn't seem to do the job. Help?

Maybe you can generate HTML and render that using a embedded browser? This
of course depends heavily on your system.

Diez
 
C

Carsten Haese

I'm trying to show a number of Checkbuttons (each with associated text
based on a list of names) inside a y-scrollable Text widget like so:

[ ] Bob
[ ] Carol
[ ] Ted
[ ] Alice
etc.
etc.

There may be quite a few (as many as 100 or so). I'm uncertain as to
the correct way to get these into the Text widget. I've tried
text.insert and it doesn't seem to do the job. Help?

Does it have to be a text widget? wxWidgets has a wxCheckListBox class
that does precisely what you need, but it's not a text widget.

HTH,

Carsten.
 
L

Lou G

For anyone who might be able to use this technique:
I kept playing around and got it to work:

for i in nameList:
btnText = name
self.sv = []
cb = []
cb.append(Checkbutton(self.datalist, text=btnText,
variable=self.sv, background='white', font=("Courier", 10)))
self.datalist.window_create(INSERT, window=cb)
self.datalist.insert(END, '\n')

Thank you for your replies,
Lou
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top