def AA(self): s = self.cd.customCount() # 返回自定义颜色的格数 s = QColorDialog.customCount() # 返回自定义颜色的格数 # 16 QColorDialog.setCustomColor(0, QColor(255, 0, 0)) # 在自定义面板中自定义颜色 # 参数1 格的序号 # 参数2 颜色 # 在显示之前设置好 s = QColorDialog.customColor(0) # 获取自定义面板的颜色 -> QColor # 参数 格序号 QColorDialog.setStandardColor(5, QColor(0, 0, 255)) # 在标准颜色面板中自定义颜色 # 参数1 格的序号 # 参数2 颜色 s = QColorDialog.standardColor(5) # 获取标准颜色面板的颜色 -> QColor # 参数 格序号 self.cd.show()