#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 without registration, duration hours minute second in high quality. This video was added by user Bro Code 28 July 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,965 once and liked it 55 people.