473,326 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Checkbuttons in a Text widget

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

Feb 17 '06 #1
4 1451
Lou G wrote:
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.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Feb 17 '06 #2
Lou G wrote:
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
Feb 17 '06 #3
On Fri, 2006-02-17 at 10:28, Lou G wrote:
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.
Feb 17 '06 #4
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[i]
self.sv = []
cb = []
cb.append(Checkbutton(self.datalist, text=btnText,
variable=self.sv[i], background='white', font=("Courier", 10)))
self.datalist.window_create(INSERT, window=cb[i])
self.datalist.insert(END, '\n')

Thank you for your replies,
Lou

Feb 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Frank Chen | last post by:
Hi: The attahced file is an example that confuses me. When executing test.py and then click menu, you can see the menu constitutes 'New Window', 'Open File', and an activated checkbutton,...
2
by: Srinath Avadhanula | last post by:
Hello, Sorry to be bringing up what seems to be a somewhat beaten up topic... This is what I wanted to do: Create a _simple_ text editor widget which supports VI(M) style keybindings but...
2
by: Tonino | last post by:
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the...
0
by: William Gill | last post by:
OK I'm tired, I've got a cold, and my brain isn't working very well. I have a result set ( a tuple of tuples) from a db. Each element has two elements; classification number, and classification...
1
by: valen1260 | last post by:
I'd like to have a multicolumn listbox, with one column being a list of items and the other being a list of checkbuttons. The user could check his "favorites" and then shorten the list to show...
2
by: nholtz | last post by:
Is there any way to delete a widget (window) from a Text widget, and then add it back to the Text, without re-creating the original widget. For example, I think I would like to do something like...
5
by: deacon.sweeney | last post by:
Hi, I've been searching for a .resize()-like function to overload much like can be done for the delete window protocol as follows: toplevel.protocol("WM_DELETE_WINDOW", callback) I realize...
2
by: Gigs_ | last post by:
from Tkinter import * states = def onpress(i): states = not states root = Tk() for i in range(10):
3
by: mariox19 | last post by:
Are Tkinter widgets running on their own thread? If I try to make a simple application that will print the letters A to Z to a Tkinter Text widget, and I space the printing of each letter by 1...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.