views:

27

answers:

1

hi,

I'm developing an application in VTK / TK and I was wondering what's the best way to provide the user with a table which lists items and allow the user to pick the color for each item:

item1 | color
item2 | color
item3 | color

thanks

+1  A: 

I would create a frame, then write a loop that creates a label widget and a button for each item. The background of the button would be the current color. There needs not be any text on the button, just make it square. The button would call a method that calls tk_chooseColor to get a color from the user.

Bryan Oakley
all this stuff is done with tkinter library ? Or I can do it directly in vtk ?
Patrick
I don't know anything about vtk; I would do this all in Tkinter.
Bryan Oakley
@Bryan Oackley is tk_chooseColor running with python ? Which library should I import to use it ?
Patrick
@Patrick: my mistake. `tk_colorChooser` is the Tcl name. With Tkinter you would use it like `from tkColorChooser import askcolor; color=askcolor()`
Bryan Oakley