def MainGUI(): # app = QApplication(sys.argv) app = QApplication([]) win = QMainWindow() win.setGeometry(200, 200, 300, 450) win.setFixedSize(300, 450) win.setWindowTitle("FotoPDF") app.setWindowIcon(QIcon(resource_path('FotoPDF.png'))) detail_widget = QTextEdit(win) detail_widget.setAlignment(Qt.AlignCenter) highlighter = Highlighter(detail_widget.document()) detail_widget.setReadOnly(True) detail_widget.setText("Tip: it works with both a folder or any file in that folder.") detail_widget.setGeometry(0, 300, 300, 150) detail_widget.setStyleSheet("background-color: rgb{}; color: rgb(255,255,255);".format(str(MACOSDARK))) # Create widget to accept drag&drop header_widget = FileEdit(win, detail_widget) header_widget.setAlignment(Qt.AlignCenter) header_widget.setReadOnly(True) header_widget.setText("Drag folder here") header_widget.setGeometry(0, 0, 300, 300) font = header_widget.font() font.setPointSize(32) header_widget.setFont(font) header_widget.setStyleSheet( "background-color: rgb{}; color: rgb(255,255,255);border : 5px solid rgb{};".format(str(MACOSYELLOW), str(MACOSDARK))) win.show() sys.exit(app.exec_())
def start(self): """Display the main window and pass control to the Gui object.""" main_window = QMainWindow() self.main_window = main_window self._build_menu_bar(main_window) tab_holder = TabHolder() self.tab_holder = tab_holder main_window.setCentralWidget(tab_holder) main_window.setGeometry(0, 0, 1000, 700) main_window.show() if len(sys.argv) > 1: self.create_or_open_database(sys.argv[1]) self.exec_()
import sys from PySide2.QtWidgets import QApplication, QMainWindow aplicacao = QApplication(sys.argv) janela = QMainWindow() # setGeometry(esquerda, topo, largura, altura) janela.setGeometry(100, 50, 300, 200) janela.setWindowTitle("Primeira Janela") janela.show() aplicacao.exec_() sys.exit()