def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) #super().__init__() self.ui = window.Ui_MainWindow() self.ui.setupUi(self) self.title = 'PyQt5 Video' self.filter = [cv2.COLOR_BGR2RGB] self.initUI() self.initButtonDict()
def __init__(self): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.ui = window.Ui_MainWindow() self.ui.setupUi(MainWindow) MainWindow.show() # 获取文本框内容 self.ui.pushButton.clicked.connect(self.click_success) sys.exit(app.exec_())
def __init__(self): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.raw_image = None self.ui = window.Ui_MainWindow() self.ui.setupUi(MainWindow) self.action_connect() MainWindow.show() sys.exit(app.exec_())
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) self.ui = window.Ui_MainWindow() self.ui.setupUi(self) self.filename = "" self.initUI() # Здесь прописываем событие нажатия на кнопку self.ui.pushButton.clicked.connect(self.create_task)
def __init__(self): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() self.ui = window.Ui_MainWindow() self.ui.setupUi(MainWindow) self.ui.label.setScaledContents(True) self.slot_init() self.intialize() MainWindow.show() sys.exit(app.exec_())
def main(): app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = window.Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() dim = 3 sys.exit(app.exec_())
def __init__(self): super(Window, self).__init__() self.ui = window.Ui_MainWindow() self.ui.setupUi(self) self.width = QtWidgets.QDesktopWidget().width() self.height = QtWidgets.QDesktopWidget().height()-80 self.daltonico = None self.isDaltonico = False self.imagensP = {} self.descritores = None self.caminho_backup = None self.caminho_sistema = os.path.abspath(os.path.dirname(__file__)) self.projecaoComparaX = [] self.projecaoComparaY = [] self.ui.menuFerramentas.hovered.connect(self.handleMenuHovered) self.ui.actionAbrir_Dataset.triggered.connect(lambda: self.carregaImagens(caminho = None)) self.ui.actionPre_Processamento_Automatico.triggered.connect(self.executarPreProcessamento) self.ui.actionDeteccao_de_Caracteristicas.triggered.connect(self.executarDeteccao) self.ui.actionImagens.triggered.connect(self.exibirImagens) self.ui.actionSair.triggered.connect(lambda: sys.exit(0)) self.ui.actionPCA.triggered.connect(lambda: self.executarProjecao(tipo = "PCA", callback = "menu")) self.ui.actionTSNE.triggered.connect(lambda: self.executarProjecao(tipo = "TSNE", callback = "menu")) self.ui.actionSAMMON.triggered.connect(lambda: self.executarProjecao(tipo = "SAMMON", callback = "menu")) self.ui.actionMDS.triggered.connect(lambda: self.executarProjecao(tipo = "MDS", callback = "menu")) self.ui.actionRecorteLivre.triggered.connect(self.exibirListaImagens) self.ui.actionDividir_Imagem.triggered.connect(self.dividirImagem) self.ui.actionCriar_Classe.triggered.connect(self.criarClasse) self.ui.actionEqualizacao.triggered.connect(lambda: self.executarFiltros(filtro = "equalizacao")) self.ui.actionMediana.triggered.connect(lambda: self.executarFiltros(filtro = "medianaw")) self.ui.actionBinarizacao.triggered.connect(lambda: self.executarFiltros(filtro = "binarizacao")) self.ui.actionInversao.triggered.connect(lambda: self.executarFiltros(filtro = "inversao")) self.ui.actionOperadores.triggered.connect(lambda: self.executarFiltros(filtro = "operadores")) self.ui.dockWidget_6.setMinimumSize(self.width/2,self.height/2.2) self.ui.dockWidget_7.setMinimumSize(self.width/2,self.height/2.2) self.ui.dockWidget_8.setMinimumSize(self.width/2,self.height/2.2) self.ui.dockWidget_9.setMinimumSize(self.width/2,self.height/2.2) self.showMaximized() self.ui.tableWidget.setVisible(False)
import sys import window from PyQt5.QtWidgets import QApplication, QMainWindow if __name__ == '__main__': app = QApplication(sys.argv) mainWindow = QMainWindow() ui = window.Ui_MainWindow() #向主窗口添加控件 ui.setupUi(mainWindow) mainWindow.show() sys.exit(app.exec_())
def __init__(self, parent=None): """ This constructor instantiate the GUI and call other functions in action It also defined some of our basic data structures used in the backend. """ # QWidget.__init__(self, parent) super(OpExpGen, self).__init__(parent) self.ui = window.Ui_MainWindow() self.ui.setupUi(self) self.setWindowIcon(QIcon(':/icon.png')) self.center() # This initializes our message box to be used through out the gui self.msg = QMessageBox() self.msg.setIcon(QMessageBox.Warning) self.msg.setWindowTitle("Invalid Input") self.app_grid = grid.Grid() # This contains our Grid data structure self.inter_grid = intermediate.IntermediateGrid() for _ in range(5): self.inter_grid.add_row() self.inter_grid.add_column() self.dragAt = DragAt( self ) # This represents a QDialog popup gui to be used in composition and substitution # This represents our pop-up dialog for creating functions/constants self.create_func_const_dialog = CreateFuncDialog(self) # This represents an object for displaying the cell's intersection in 2d self.view_2d_cell = TwoDView(self) # This represents an object for exporting expressions to a file self.export_exp = ExportExpressionDialog(self) # This defines our dictionary for storing functions and their attributes self.defined_functions = {} # They call associated functions when certain push buttons are clicked self.create_func_const_dialog.ui.pushButton_save.clicked.connect( self.save_func) self.ui.pushButton_delete_row.clicked.connect(self.remove_row) self.ui.pushButton_delete_column.clicked.connect(self.remove_column) self.ui.pushButton_delete_cell.clicked.connect(self.clear_cell) self.ui.pushButton_create.clicked.connect( self.create_func_const_dialog.exec_) self.ui.pushButton_2d.clicked.connect(self.display_2d) self.ui.pushButton_del_inter_cell.clicked.connect( self.clear_inter_cell) self.ui.pushButton_clear_inter_cell.clicked.connect( self.clear_inter_grid) self.ui.pushButton_export_exp.clicked.connect(self.export_expression) self.ui.pushButton_meaning.clicked.connect(self.meaning) # They call associated functions when certain menu actions are triggered self.ui.action_New.triggered.connect(self.file_new) self.ui.action_Open.triggered.connect(self.file_open) self.ui.action_Save.triggered.connect(self.file_save) self.ui.action_SaveAs.triggered.connect(self.file_save_as) self.ui.action_Exit.triggered.connect(self.close) self.ui.actionAbout_Software.triggered.connect(self.about) self.ui.action_User_Manual.triggered.connect(self.manual) # This enables the event filter at the application function and intermediate result table self.ui.tableWidget_func.viewport().installEventFilter(self) self.ui.tableWidget_inter.viewport().installEventFilter(self) self.ui.radioButton_add.setChecked( True) # sets the default check button to radio button add # This fragment below handles what happens to the GUI upon startup # like maintaining the previous state of the GUI settings = QSettings() self.restoreGeometry(settings.value("OpExpGen/Geometry", QByteArray())) self.restoreState(settings.value("OpExpGen/State", QByteArray())) QTimer.singleShot(0, self.load_initial_file) self.setWindowTitle("Operator and Expression Generation")