PyQt5 QColorDialog - Getting Font Last Updated : 24 Jun, 2020 Comments Improve Suggest changes Like Article Like Report In this article we will see how we can get the font of QColorDialog. Font is the style i.e properties of the text present in the color dialog. We use setFont method to set the font to the dialog. Note : Increasing size of font will increase the size of the dialog box although dialog size is fixed In order to do this we use font method with the QColorDialog object Syntax : dialog.font() Argument : It takes no argument Return : It returns QFont object Below is the implementation Python3 1== # importing libraries from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtGui from PyQt5.QtGui import * from PyQt5.QtCore import * import sys class Window(QMainWindow): def __init__(self): super().__init__() # setting title self.setWindowTitle("Python ") # setting geometry self.setGeometry(100, 100, 500, 400) # calling method self.UiComponents() # showing all the widgets self.show() # method for components def UiComponents(self): # creating a QColorDialog object dialog = QColorDialog(self) # setting custom colors dialog.setCustomColor(1, Qt.red) dialog.setCustomColor(2, Qt.green) dialog.setCustomColor(3, Qt.yellow) dialog.setCustomColor(4, Qt.blue) # font font = QFont('Times', 12) # setting font to the dialog dialog.setFont(font) # creating label label = QLabel("Geeks for Geeks", self) label.setAlignment(Qt.AlignCenter) # making label multi line label.setWordWrap(True) # setting stylesheet of the label label.setStyleSheet("QLabel" "{" "border : 5px solid black;" "}") # getting the custom color color = dialog.customColor(4) # setting graphic effect to the label graphic = QGraphicsColorizeEffect(self) # setting color to the graphic graphic.setColor(color) # setting graphic to the label label.setGraphicsEffect(graphic) layout = dialog.layout() layout.addWidget(label) dialog.setLayout(layout) # getting font value = dialog.font() # setting text to the label label.setText("Font : " + str(value)) dialog.exec_() self.deleteLater() # create pyqt5 app App = QApplication(sys.argv) # create the instance of our Window window = Window() # start the app sys.exit(App.exec()) Output : Comment More infoAdvertise with us Next Article PyQt5 QColorDialog - Getting Font R rakshitarora Follow Improve Article Tags : Python Python-PyQt Python-gui Python PyQt-QColorDialog Practice Tags : python Similar Reads PyQt5 QColorDialog - Getting Current Color In this article we will see how we can get the current color of the QColorDialog widget. User can select the color with the mouse or using the spin boxes present there but the initial color always remain white in order to change this we can set the current of the color dialog before executing it. Cu 2 min read PyQt5 QColorDialog - Getting Custom Color In this article we will see how we can get the custom color of the QColorDialog widget. Custom colors the color made by the user they can be set at the run time with the help of mouse although we can add custom color programmatically with the help of setCustomColor method, by default all custom colo 2 min read PyQt5 QColorDialog - Getting Layout In this article we will see how we can get the layout of the QColorDialog. Layout is the map of all the child existed in the dialog, layout consist of the children of the dialog, each widget is added one by one in the layout. In order to do this we use layout method with the QColorDialog object Synt 2 min read PyQt5 QCalendarWidget - Getting Font In this article we will see how we can get the font of the QCalendarWidget. A font is a particular size, weight and style of a typeface. Each font was a matched set of type, one piece for each glyph. By changing font we can change the style of the text present in the calendar. We can change/set font 2 min read PyQt5 QColorDialog - Changing Font In this article we will see how we can change the font of QColorDialog. Font is the style i.e properties of the text present in the color dialog. Note : Increasing size of font will increase the size of the dialog box although dialog size is fixed In order to do this we use setFont method with the Q 2 min read PyQt5 QColorDialog - Making color done In this article we will see how we can done the color in the QColorDialog widget. This closes the dialog and sets its result code to r. The finished signal will be emitted, if r is QDialog::Accepted or QDialog::Rejected, the accepted or the rejected signals will also be emitted, respectively. In ord 2 min read PyQt5 - QColorDialog QColorDialog It is a dialog box of a color picker widget. A color picker is a graphical user interface widget, usually found within graphics software or online, used to select colors and sometimes to create color schemes. Below is how the QColorDialog looks like It is popup type widget in PyQt5 it b 2 min read PyQt5 QColorDialog - Getting Color Dialog Options In this article we will see how we can get the options of the QColorDialog widget. There are basically three dialog options available for the QColorDialog widget, below are the options - 1. ShowAlphaChannel : Allow the user to select the alpha component of a color 2. NoButtons : Don't display OK and 2 min read PyQt5 QColorDialog - Children In this article we will see how we can get the children of QColorDialog widget. QColorDialog widget consist of multiple widgets like QLabel, QPushButton, QSpinBox and many other widgets. Combining these widgets forms the color dialog. In order to do this we use children method with the QColorDialog 2 min read PyQt5 QColorDialog - Child at given point In this article we will see how we can get the child of QColorDialog widget at the given point. QColorDialog widget consist of multiple widgets like QLabel, QPushButton, QSpinBox and many other widgets. Combining these widgets forms the color dialog. In order to do this we use childAt method with th 2 min read Like