Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main.py
- import sys
- from PyQt5.QtWidgets import (QLineEdit, QVBoxLayout, QMainWindow,
- QWidget, QDesktopWidget, QApplication, QPushButton, QLabel,
- QComboBox, QFileDialog, QRadioButton)
- from PyQt5.QtCore import pyqtSlot, QByteArray
- from alert import Window2
- from test import test
- class SG(QWidget):
- def __init__(self):
- super().__init__()
- self.initUI()
- def initUI(self):
- self.resize(300, 150)
- self.setWindowTitle('TEST')
- self.resultsGen = QPushButton('TEST', self)
- self.resultsGen.clicked.connect(lambda: self.on_click())
- self.show()
- @pyqtSlot()
- def on_click(self):
- test(self)
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- sg = SG()
- sys.exit(app.exec_())
- ======================================================================================================
- alert.py
- from PyQt5.QtWidgets import (QLineEdit, QVBoxLayout, QMainWindow,
- QWidget, QDesktopWidget, QApplication, QPushButton, QLabel,
- QComboBox, QFileDialog, QRadioButton)
- from PyQt5.QtCore import pyqtSlot, QByteArray
- from PyQt5.QtGui import QPixmap
- from PyQt5 import QtGui, QtCore
- class Window2(QMainWindow):
- def __init__(self):
- super().__init__()
- self.initPopup()
- def initPopup(self):
- self.resize(500, 500)
- self.setWindowTitle("Window22222")
- self.central_widget = QWidget()
- self.setCentralWidget(self.central_widget)
- lay = QVBoxLayout(self.central_widget)
- label = QLabel(self)
- pixmap = QPixmap('cropped/8.png')
- label.setPixmap(pixmap)
- self.resize(pixmap.width(), pixmap.height())
- lay.addWidget(label)
- self.textbox = QLineEdit(self)
- self.textbox.move(20, 20)
- self.textbox.resize(280, 40)
- # Create a button in the window
- self.button = QPushButton('Show text', self)
- self.button.move(20, 80)
- # connect button to function on_click
- self.button.clicked.connect(lambda: self.on_clickX())
- self.show()
- @pyqtSlot()
- def on_clickX(self):
- textboxValue = self.textbox.text()
- print(textboxValue)
- self.textbox.setText("")
- self.hide()
- ======================================================================================================
- test.py
- from alert import Window2
- def test(self):
- for i in range(2):
- for x in range(6):
- w = Window2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement