import PyQt5.QtWidgets as qtw
import PyQt5.QtGui as qtg
class MainWindow(qtw.QWidget):
def init(self):
super().init()
# Add a tittle
self.setWindowTitle(“Hello World!!!”)
# Set Vertical layout
self.setLayout(qtw.QVBoxLayout())
# Create a label
my_label = qtw.QLabel("Hello World! What's Your Name?")
# Change the font size of label
my_label.setFont(qtg.QFont('Helvetica', 18))
self.layout().addWidget(my_label)
# Create an entry box
my_entry = qtw.QLineEdit()
my_entry.setObjectName("name_field")
my_entry.setText("")
self.layout().addWidget(my_entry)
# Create a button
my_button = qtw.QPushButton("Press me",
clicked = lambda: press_it())
self.layout().addWidget(my_button)
def press_it():
# Add name to label
my_label.setText(f'Hello {my_entry.text()}!')
# clear the entry box
myentry.setText("")
# Show the app
self.show()
app = qtw.QApplication()
mw = MainWindow()
Run The App
app.exec()
The app isn’t showing if you find any problems please tell me thankyou. I am using sublime text and pyqt5 grapical interface