简体   繁体   English

如何在python中使用VTK / TK实现颜色表

[英]How can I implement a color table with VTK / TK in python

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:我正在 VTK / TK 中开发一个应用程序,我想知道为用户提供一个列出项目并允许用户为每个项目选择颜色的表格的最佳方式是什么:

item1 | color
item2 | color
item3 | color

thanks谢谢

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.该按钮将调用一个调用 tk_chooseColor 的方法来从用户那里获取颜色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM