{"id":246248,"date":"2021-12-28T05:08:05","date_gmt":"2021-12-28T05:08:05","guid":{"rendered":"https:\/\/imarticus.org\/?p=246248"},"modified":"2024-04-06T20:13:18","modified_gmt":"2024-04-06T20:13:18","slug":"heres-how-to-create-your-first-desktop-application-in-python","status":"publish","type":"post","link":"https:\/\/imarticus.org\/blog\/heres-how-to-create-your-first-desktop-application-in-python\/","title":{"rendered":"Here&#8217;s how to create your first desktop application in python"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Most young developers have questions about creating desktop software using python. But before going into the process of developing a desktop application, they should <\/span><a href=\"https:\/\/imarticus.org\/blog\/python-course-for-beginners-about-python-program-salary-and-trends-in-2022\/\"><b>learn python programming<\/b><\/a><span style=\"font-weight: 400;\"> beforehand to learn concepts related to python.<\/span><\/p>\n<h3><b>Step By Step Guide to Create a GUI App in Python<\/b><\/h3>\n<p><b>Step 1<\/b><\/p>\n<p><span style=\"font-weight: 400;\">In this step, define the current task. Deciding what needs to be solved with the application explains further steps. The field has a variety of usage, for example, Data Visualizations, personal application performance to work with images, text, Business automation GUI&#8217;s for managing tasks, and developing systems and monitoring. <\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-246250 size-medium\" src=\"https:\/\/imarticus.org\/blog\/wp-content\/uploads\/2021\/12\/python-for-data-science-300x169.jpg\" alt=\"best ai and ml courses\" width=\"300\" height=\"169\" srcset=\"https:\/\/imarticus.org\/blog\/wp-content\/uploads\/2021\/12\/python-for-data-science-300x169.jpg 300w, https:\/\/imarticus.org\/blog\/wp-content\/uploads\/2021\/12\/python-for-data-science-1024x576.jpg 1024w, https:\/\/imarticus.org\/blog\/wp-content\/uploads\/2021\/12\/python-for-data-science-768x432.jpg 768w, https:\/\/imarticus.org\/blog\/wp-content\/uploads\/2021\/12\/python-for-data-science.jpg 1280w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/>Primary estimation of the functionality and size of the application is necessary as it will help choose the best-suited GUI tool kit. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">In case you are not familiar with Graphical User Interface (GUI), it is recommended to take any of the available <\/span>AI and machine learning courses<span style=\"font-weight: 400;\"> to clear the fundamentals.\u00a0\u00a0<\/span><\/p>\n<p><b>Step 2\u00a0\u00a0\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Choose the correct GUI package and play around with it using python. There are multiple Python-based packages available to do this. One of the easiest ways to do so is by using Tkinter. It allows developers to create small and simple applications using a GUI interface. Popular third-party packages include PyQt, Kivy, WxPython, and Pyside. To know about these, individuals can look at the <\/span><b><a href=\"https:\/\/imarticus.org\/blog\/heres-how-to-create-your-first-desktop-application-in-python\/\">Python desktop application development tutorial<\/a>.<\/b><\/p>\n<p><b>Step 3<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here PyQt5 is used as a GUI toolkit for the desktop application. Next, download and install the package.<\/span><\/p>\n<p><b>Step 4\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Then create a pyqt_app1.py file to import PyQt5 modules. After creating PyqtApp class, in the _init_function, in the bottom, create and import instruction with a file name with if _name+ == \u201c_main\u201d: and type lines with calling pyqt based app, importing sys module, calling show () to start the GUI application.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">from PyQt5 import QtWidgets, QtGui, QtCore<\/span><\/p>\n<p><span style=\"font-weight: 400;\">class PyQtApp(QtWidgets.QWidget):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def __init__(self, parent=None):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 QtWidgets.QWidget.__init__(self, parent)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowTitle(&#8220;PyQt Application&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowIcon(QtGui.QIcon(&#8220;Your\/image\/file.png&#8221;))<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">if __name__ == &#8220;__main__&#8221;:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 import sys<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 app = QtWidgets.QApplication(sys.argv)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp = PyQtApp()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.show()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 sys.exit(app.exec_())<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><b>Step 5<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Then add some style, font, and position of the application. Change the background colour by altering the line &#8211; self.element.setStyleSheet(\u201cbackground-color: #hex number or rgba(). But to position the window, a desktop resolution is required. But this can be done by using multiple codes.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">from PyQt5 import QtWidgets, QtGui, QtCore<\/span><\/p>\n<p><span style=\"font-weight: 400;\">class PyQtApp(QtWidgets.QWidget):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def __init__(self, parent=None):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 QtWidgets.QWidget.__init__(self, parent)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowTitle(&#8220;PyQt Application&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowIcon(QtGui.QIcon(&#8220;Your\/image\/file.png&#8221;))<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setMinimumWidth(resolution.width() \/ 3)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setMinimumHeight(resolution.height() \/ 1.5)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setStyleSheet(&#8220;QWidget {background-color:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0rgba(0,41,59,255);}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0QScrollBar:horizontal {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0width: 1px; height: 1px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(0,41,59,255);} \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0QScrollBar:vertical {width: 1px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0height: 1px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(0,41,59,255);}&#8221;)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">if __name__ == &#8220;__main__&#8221;:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 import sys<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 app = QtWidgets.QApplication(sys.argv)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 desktop = QtWidgets.QApplication.desktop()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 resolution = desktop.availableGeometry()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp = PyQtApp()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.setWindowOpacity(0.95)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.show()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.move(resolution.center() &#8211; myapp.rect().center())<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 sys.exit(app.exec_())<\/span><\/p>\n<p><span style=\"font-weight: 400;\">else:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 desktop = QtWidgets.QApplication.desktop()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 resolution = desktop.availableGeometry()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><b>Step 6<\/b><\/p>\n<p><span style=\"font-weight: 400;\">In this step, adding functionality to the app is necessary. After all, while solving tasks, a graphical interface will make the user comfortable using the application. We can also add frames, fields, buttons and other graphics into the application. Using buttons and text fields will provide good and effective results. For best view buttons, here is how to create a new class for the application with styling and font.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">from PyQt5 import QtWidgets, QtGui, QtCore<\/span><\/p>\n<p><span style=\"font-weight: 400;\">font_but = QtGui.QFont()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">font_but.setFamily(&#8220;Segoe UI Symbol&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">font_but.setPointSize(10)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">font_but.setWeight(95)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">class PushBut1(QtWidgets.QPushButton):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def __init__(self, parent=None):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 super(PushBut1, self).__init__(parent)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setMouseTracking(True)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setStyleSheet(&#8220;margin: 1px; padding: 7px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(1,255,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0color: rgba(1,140,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-style: solid;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-radius: 3px; border-width: 0.5px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-color: rgba(1,140,0,100);&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def enterEvent(self, event):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setStyleSheet(&#8220;margin: 1px; padding: 7px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background- color: rgba(1,140,040,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0color: rgba(1,140,255,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-style: solid; border-radius: 3px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-width: 0.5px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-color: rgba(1,140,140,100);&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def leaveEvent(self, event):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setStyleSheet(&#8220;margin: 1px; padding: 7px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(1,255,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0color: rgba(1,140,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-style: solid;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-radius: 3px; border-width: 0.5px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-color: rgba(1,140,0,100);&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">class PyQtApp(QtWidgets.QWidget):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 def __init__(self, parent=None):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 QtWidgets.QWidget.__init__(self, parent)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowTitle(&#8220;PyQt Application&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setWindowIcon(QtGui.QIcon(&#8220;Your\/image\/file.png&#8221;))<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setMinimumWidth(resolution.width() \/ 3)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setMinimumHeight(resolution.height() \/ 1.5)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setStyleSheet(&#8220;QWidget<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{background-color: rgba(1,255,0,100);}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0QScrollBar:horizontal<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{width: 1px; height: 1px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(0,140,0,255);}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0QScrollBar:vertical<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{width: 1px; height: 1px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: rgba(0,140,0,255);}&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.textf = QtWidgets.QTextEdit(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.textf.setPlaceholderText(&#8220;Results&#8230;&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.textf.setStyleSheet(&#8220;margin: 1px; padding: 7px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0background-color: \u00a0 \u00a0 \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0rgba(1,255,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0color: rgba(1,140,0,100);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-style: solid;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-radius: 3px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-width: 0.5px;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0border-color: rgba(1,140,0,100);&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but1 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but1.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but1.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but1.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but2 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but2.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but2.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but2.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but3 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but3.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but3.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but3.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but4 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but4.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but4.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but4.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but5 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but5.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but5.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but5.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but6 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but6.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but6.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but6.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but7 = PushBut1(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but7.setText(&#8220;\ue2b5&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but7.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.but7.setFont(font_but)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1 = QtWidgets.QGridLayout()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.textf, 0, 0, 14, 13)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but1, 0, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but2, 1, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but3, 2, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but4, 3, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but5, 4, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but6, 5, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.addWidget(self.but7, 6, 14, 1, 1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.grid1.setContentsMargins(7, 7, 7, 7)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.setLayout(self.grid1)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">if __name__ == &#8220;__main__&#8221;:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 import sys<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 app = QtWidgets.QApplication(sys.argv)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 desktop = QtWidgets.QApplication.desktop()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 resolution = desktop.availableGeometry()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp = PyQtApp()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.setWindowOpacity(0.95)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.show()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 myapp.move(resolution.center() &#8211; myapp.rect().center())<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 sys.exit(app.exec_())<\/span><\/p>\n<p><span style=\"font-weight: 400;\">else:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 desktop = QtWidgets.QApplication.desktop()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 resolution = desktop.availableGeometry()<\/span><\/p>\n<p><b>Step 7<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You can add a few more fields and explore the possibilities of PyQt.<\/span><\/p>\n<p><b>Step 8<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Then connect the buttons and functions for a calling event. For this, we need to add an additional line to the\u00a0 _init_ function of the main class.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">self.but1.clicked.connect(self.on_but1)<\/span><\/p>\n<p><b>Step 9<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You can add images in this step. The second button in the image will call the image file from the text to put it in the right bottom corner.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Adding QLabel:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">self.lb1 = QtWidgets.QLabel(self)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">self.lb1.setFixedWidth(72)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">self.lb1.setFixedHeight(72)<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Adding function:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">def on_but2(self):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 txt = self.textf.toPlainText()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 try:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 img = QtGui.QPixmap(txt)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 self.lb1.setPixmap(img.scaledToWidth(72,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0QtCore.Qt.SmoothTransformation))<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 except:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 pass<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To connect the second button and the function:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">self.but2.clicked.connect(self.on_but2)<\/span><\/p>\n<p><b>Step 10<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Complete and run the application. Apart from this PyQt has various other applications, and you can use those to create complete desktop applications.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0If you are not familiar with coding, you can <\/span><b>learn python programming<\/b><span style=\"font-weight: 400;\"> or enroll in any <\/span><b>AI and machine learning courses. <\/b><span style=\"font-weight: 400;\">Apart from this, you can also look at the <\/span><b>Python desktop application development tutorial<\/b><span style=\"font-weight: 400;\">.\u00a0<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Level 1<\/b><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Copyscape Premium Verification<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Text Clear, But Code Matched<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Grammarly Premium Score<\/span><\/td>\n<td><span style=\"font-weight: 400;\">96<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Readability Score<\/span><\/td>\n<td><span style=\"font-weight: 400;\">12.1<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Primary Keyword Usage<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Done<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Secondary Keyword Usage<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Done<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Highest Word Density\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Self \u2013 7.39%\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Data\/Statistics Validation Date<\/span><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><b>Level 2<\/b><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">YOAST SEO Plugin Analysis<\/span><\/td>\n<td><span style=\"font-weight: 400;\">3 Green, 4 Red<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Call-to-action Tone Integration<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NA<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">LSI Keyword Usage<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NA<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Level 3<\/b><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Google Featured Snippet Optimization<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NA<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Content Camouflaging<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NA<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Voice Search Optimization<\/span><\/td>\n<td><span style=\"font-weight: 400;\">NA<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Generic Text Filtration<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Done<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Content Shelf-life<\/span><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Most young developers have questions about creating desktop software using python. But before going into the process of developing a desktop application, they should learn python programming beforehand to learn concepts related to python. Step By Step Guide to Create a GUI App in Python Step 1 In this step, define the current task. Deciding [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":241907,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_mo_disable_npp":"","_lmt_disableupdate":"no","_lmt_disable":"","footnotes":""},"categories":[23],"tags":[2664,3101,3102],"class_list":["post-246248","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-artificial-intelligence-and-machine-learning-courses","tag-learn-python-programming-course","tag-ai-and-ml-course"],"acf":[],"aioseo_notices":[],"modified_by":"Imarticus Learning","_links":{"self":[{"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/posts\/246248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/comments?post=246248"}],"version-history":[{"count":3,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/posts\/246248\/revisions"}],"predecessor-version":[{"id":263207,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/posts\/246248\/revisions\/263207"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/media\/241907"}],"wp:attachment":[{"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/media?parent=246248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/categories?post=246248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imarticus.org\/blog\/wp-json\/wp\/v2\/tags?post=246248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}