Python PyQt5 LINE EDITS are easy! 💬

Published: 28 July 2024
on channel: Bro Code
8,655
140

#pythontutorial #python #pythonprogramming
PyQt5 LineEdit widget
from PyQt5.QtWidgets import QApplication, QMainWindow, QLineEdit, QPushButton

class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setGeometry(700, 300, 500, 500)
self.line_edit = QLineEdit(self)
self.button = QPushButton("Submit", self)
self.initUI()

def initUI(self):
self.line_edit.setGeometry(10, 10, 200, 40)
self.button.setGeometry(210, 10, 100, 40)
self.line_edit.setStyleSheet("font-size: 25px;"
"font-family: Arial")
self.button.setStyleSheet("font-size: 25px;"
"font-family: Arial")
self.line_edit.setPlaceholderText("Enter your name")

self.button.clicked.connect(self.submit)

def submit(self):
text = self.line_edit.text()
print(f"Hello {text}")

if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())


On this page of the site you can watch the video online Python PyQt5 LINE EDITS are easy! 💬 with a duration of hours minute second in good quality, which was uploaded by the user Bro Code 28 July 2024, share the link with friends and acquaintances, this video has already been watched 8,655 times on youtube and it was liked by 140 viewers. Enjoy your viewing!