You can download this code by clicking the button below.
This code is now available for download.
This function generates a random color and returns a QColor object.
Technology Stack : PyQt5.QtGui.QColor, random
Code Type : Function
Code Difficulty : Beginner
def random_color():
from random import randint
from PyQt5.QtGui import QColor
def get_random_color():
return QColor(randint(0, 255), randint(0, 255), randint(0, 255))
return get_random_color()