I was trying to get the color of a pixel inside a QWidget I made. However I have some questions because I was learnning Python and not C++.

I came accross this post:

and they say the solution would be this:
Qt Code:
  1. QPixmap qPix = QPixmap::grabWidget(ui->myWidget);
  2. QImage image(qPix.toImage());
  3. QColor color(image.pixel(0, 1));
To copy to clipboard, switch view to plain text mode 

How would it translate to PyQt5 if this is the correct answer?