External Exam Download Resources Web Applications Games Recycle Bin

Input Text

gdaymate.py

from PyQt6.QtWidgets import (
  QApplication,
  QWidget,
  QPushButton,
  QLabel, ### <-- using label for an image
  QLineEdit,
  QTextEdit
)
from PyQt6.QtGui import QPixmap
app = QApplication([])

window = QWidget()
window.resize(250,250)
image = QLabel("", window).setPixmap(QPixmap('image.png').scaledToHeight(100))
textarea = QTextEdit("Multi-line text", window)
textarea.move(5, 110)
textarea.setFixedHeight(50)
textline = QLineEdit("Single line text", window)
textline.move(5,170)
submit = QPushButton("Submit", window)
submit.move(5, 200)
window.show()

def read():
  text = textarea.toPlainText() + " " + textline.text()
  print(text)
submit.clicked.connect(read)

app.exec() #main loop