import sys from PyQt5.QtWidgets import QWidget, QLabel, QLineEdit, QPushButton, QFileDialog from PyQt5.QtGui import QPixmap import streamlit as st class Window(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): # Text input with placeholder self.text = QLineEdit(self) self.text.setPlaceholderText("How can I kiss you") # Text input to show result self.result = QLineEdit(self) # Button to multiply input self.button = QPushButton("Multiply", self) self.button.clicked.connect(self.multiply) # File dialog to choose image self.image = QPushButton("Choose Image", self) self.image.clicked.connect(self.choose_image) # Label to show image self.img_label = QLabel(self) self.img_label.setScaledContents(True) # Layouts layout = QVBoxLayout() layout.addWidget(self.text) layout.addWidget(self.button) layout.addWidget(self.result) layout.addWidget(self.image) layout.addWidget(self.img_label) self.setLayout(layout) self.setGeometry(300, 300, 350, 200) self.setWindowTitle('PyQt5 Tutorial') self.show() def multiply(self): num = int(self.text.text()) self.result.setText(str(num * 2)) def choose_image(self): filename, _ = QFileDialog.getOpenFileName(self, 'Open File', filter="Image files (*.jpg *.png)") if filename: self.img_label.setPixmap(QPixmap(filename)) if __name__ == '__main__': app = QApplication(sys.argv) window = Window() sys.exit(app.exec_())