![]() ![]() The QPainter provides various functions to draw basic shapes. To draw graphics, import the following modules: from PyQt5.QtGui import QPainter, QBrush, QPen Our window is now ready, and we can create graphics easily: Now the main steps: Create an instance of QApplication and object of Window class then execute the window. In the constructor, the parameters are initialized and in the InitWindow() method, the parameters are applied to the window using setGeometry() function. tGeometry(self.top, self.left, self.width, self.height) The second method called InitWindow, it sets the parameters we defined in our constructor, for example, the title of our application window, length, and width, etc. Inside this class, we will have two methods the first method is a constructor, which is automatically called when the object of the class is created. Now create the Window class, which provides a window for our application where we can have a menu bar, status bar, graphics, etc. ![]() To create the window, import the following modules: from PyQt5 import QtGuiįrom PyQt5.QtWidgets import QApplication, QMainWindow
0 Comments
Leave a Reply. |