color_dialog.py 492 B

12345678910111213141516171819202122
  1. import sys
  2. from PyQt5.QtWidgets import *
  3. class colorSelector(QWidget):
  4. def __init__(self):
  5. super().__init__()
  6. self.setWindowTitle('Color Selector')
  7. self.setGeometry(600, 500, 400, 200)
  8. # OpenColorDialog
  9. color = QColorDialog.getColor()
  10. if color.isValid():
  11. print(color.name())
  12. if __name__ == '__main__':
  13. app = QApplication([])
  14. window = colorSelector()
  15. window.show()
  16. sys.exit(app.exec_())
  17. 百年難得的奇才