In Power Table ,I want to double click row , then show chooseColor, users can choose one color ,Finally the table row can change color.
def onDoubleClick(self, rowIndex, colIndex, colName, value, event):
# 获取双击行的索引
row_index = rowIndex
col_index = colIndex
# 可以根据需要获取当前行的背景颜色作为初始颜色
# 这里简单假设当前行背景颜色属性可直接获取
color_background=self.background
# current_row_color = self.rowIndex.getProperty(color_background)
print(color_background)
# 弹出颜色选择对话框,使用当前行背景颜色作为初始颜色,并设置自定义标题
selected_color = system.gui.chooseColor(color_background, u"请选择行背景颜色")
if selected_color is not None:
# 设置指定行的背景颜色为用户选择的颜色
# self.selectionBackground=selected_color
self.setProperty('rows[' + str(row_index) + '].background', selected_color)
But self.setProperty('rows[' + str(row_index) + '].background', selected_color), ERROR
Vision.Components.AdvancedTable - Error invoking extension method.
org.python.core.PyException: TypeError: 'java.awt.Color' object is not callable
How do I correct it?