Python PyQt5 LINE EDITS are easy! 💬

Published: 28 July 2024
on channel: Bro Code
2,965
55

#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_())


Watch video Python PyQt5 LINE EDITS are easy! 💬 online, duration hours minute second in high quality that is uploaded to the channel Bro Code 28 July 2024. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 2,965 times and liked it 55 visitors.