Answers for "pyqt5 ui load"

2

how to load ui file in pyqt5

class Ui(QtWidgets.QMainWindow):
    def __init__(self):
        super(Ui, self).__init__() # Call the inherited classes __init__ method
        uic.loadUi('basic.ui', self) # Load the .ui file
        self.show() # Show the GUI
Posted by: Guest on November-22-2020
0

pyqt5 load website

from PyQt5.QtWidgets import (
	QMainWindow, 
	QApplication
)
import sys


class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Example of opening a webpage")
        #Equivalent to initialize this web loading control
        self.browser = QWebEngineView()
        #Load external page, call
        self.browser.load(QUrl("http://www.baidu.com"))
        self.setCentraWidget(self.browser)
        
        
if __name__=='__main__':
    app = QApplication(sys.argv)
    win = MainWindow()
    win.show()
    sys.exit(app.exec_())
Posted by: Guest on July-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language