import sys from PyQt4.QtGui import QApplication, QPushButton app = QApplication(sys.argv) button = QPushButton('Click me', None) button.show() sys.exit(app.exec_())
import sys from PyQt4.QtGui import QApplication, QWidget app = QApplication(sys.argv) window = QWidget() window.setWindowTitle('My App') window.setGeometry(100, 100, 300, 200) window.show() sys.exit(app.exec_())This code creates a simple window with a title 'My App'. The `QWidget` class is used to create the window. The `setWindowTitle` method is used to set the title of the window, and `setGeometry` method is used to set the position and size of the window. In conclusion, PyQt4 QtGui is a powerful package library for creating graphical user interfaces for Python desktop applications. Its components can be used to create simple and complex user interfaces.