How to show all UI from another python file in current file when button is clicked for pyqt5
-
Basically I have this code and I want to display all the UI elements from another pyqt5 python file in this file when the button is clicked. How do I do this?
import sys
from PyQt5 import *
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *class MainWindow(QMainWindow):
def init(self):
QMainWindow.init(self)self.setMinimumSize(QSize(300, 200)) self.setWindowTitle("PyQt button example - pythonprogramminglanguage.com") pybutton = QPushButton('Click me', self) pybutton.clicked.connect(self.clickMethod) pybutton.resize(100,32) pybutton.move(50, 50) def clickMethod(self): print('Clicked Pyqt button.')
if name == "main":
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit( app.exec_() ) -
Basically I have this code and I want to display all the UI elements from another pyqt5 python file in this file when the button is clicked in the same window. How do I do this?
import sys
from PyQt5 import *
from PyQt5.QtWidgets import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class MainWindow(QMainWindow):
def init(self):
QMainWindow.init(self)
self.setMinimumSize(QSize(300, 200))
self.setWindowTitle("PyQt button example - pythonprogramminglanguage.com")pybutton = QPushButton('Click me', self) pybutton.clicked.connect(self.clickMethod) pybutton.resize(100,32) pybutton.move(50, 50)
def clickMethod(self):
print('Clicked Pyqt button.')
if name == "main":
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit( app.exec_() )