def startGUI(): app = QApplication([]) app.setStyle('Fusion') if opts.timeclockOpts["darkTheme"]: pass window = QWidget() window.setWindowTitle(opts.timeclockOpts["title"]) window.setWindowIcon( QtGui.QIcon("../data/assets/" + opts.timeclockOpts["logo"])) mainLayout = QVBoxLayout() mainLayout.setSpacing(20) mainLayout.addLayout(makeTitle()) global tabsObject tabsObject = makeNameArea() mainLayout.addWidget(tabsObject) updateNamesTable() mainLayout.addLayout(makeActions(app)) window.setLayout(mainLayout) window.show() print("1024 x 768") print(window.width(), " x ", window.height()) print("", 1024 - window.width(), "\t", 768 - window.height()) app.exec()
def develop(): from PyQt6.QtWidgets import QApplication, QLabel app = QApplication([]) r = RotatingIcon(icon_size=64) l = QLabel() l.setPixmap(r.first_frame) r.updated.connect(l.setPixmap) r.start() l.show() app.exec()
def run_gui(): # Creat an instance of PyQt6 application # Every PyQt6 application has to contain this line app = QApplication(sys.argv) # Set the default icon to use for all the windows of our application app.setWindowIcon( QIcon('GUI/gui_icon.ico')) # GUI Icon, feel free to change # Create an instance of the GUI window. window = MainWindow() window.show() # Next line hands the control over to Python GUI app.exec()
def gmxmmpbsa_ana(): try: from PyQt6.QtWidgets import QApplication pyqt = True except: try: from PyQt5.QtWidgets import QApplication pyqt = True except: pyqt = False finally: if not pyqt: GMXMMPBSA_ERROR( 'Could not import PyQt5/PyQt6. gmx_MMPBSA_ana will be disabled until PyQt5/PyQt6 is ' 'installed') from GMXMMPBSA.analyzer.gui import GMX_MMPBSA_ANA from GMXMMPBSA.analyzer.utils import get_files app = QApplication(sys.argv) app.setApplicationName('gmx_MMPBSA Analyzer (gmx_MMPBSA_ana)') try: parser = anaparser.parse_args(sys.argv[1:]) except CommandlineError as e: GMXMMPBSA_ERROR('%s: %s' % (type(e).__name__, e)) sys.exit(1) ifiles = get_files(parser) w = GMX_MMPBSA_ANA() w.gettting_data(ifiles) w.show() sys.exit(app.exec())
def main(): app = QApplication(sys.argv) ventana = VentanaPrincipal() ventana.show() sys.exit(app.exec())
def App(): app = QApplication(sys.argv) win = QWidget() win.setWindowTitle("PyQt6 QLabel Example") win.left = 100 win.top = 100 l1 = QLabel("Hello World") l2 = QLabel("Welcome to Python GUI Programming") # # Because you can't instantiate a QLable directly with a QPixmap. # l3 = QLabel() l3.setPixmap(QPixmap("python-small.png")) l1.setAlignment(Qt.Alignment.AlignCenter) l2.setAlignment(Qt.Alignment.AlignCenter) l3.setAlignment(Qt.Alignment.AlignCenter) vbox = QVBoxLayout() vbox.addWidget(l1) vbox.addStretch() vbox.addWidget(l2) vbox.addStretch() vbox.addWidget(l3) vbox.addStretch() win.setLayout(vbox) win.show() sys.exit(app.exec())
def main(): app = QApplication(sys.argv) ventana = Captura_Datos() ventana.show() sys.exit(app.exec())
def main(): app = QApplication(sys.argv) ventana = Ventana_Calculadora() ventana.show() sys.exit(app.exec())
def execute(self): app = QApplication([]) tab1 = 20 tab2 = 110 yStart = 10 yInc = 20 w = QWidget() w.setGeometry(100, 100, 320, 240) w.setWindowTitle('World Clock') self._utc_label = self._create_label(w, 'UTC:', yStart, tab1, tab2) self._eastern_label = self._create_label(w, 'US/Eastern:', yStart + yInc * 2, tab1, tab2) self._central_label = self._create_label(w, 'US/Central:', yStart + yInc * 3, tab1, tab2) self._mountain_label = self._create_label(w, 'US/Mountain:', yStart + yInc * 4, tab1, tab2) self._pacific_label = self._create_label(w, 'US/Pacific:', yStart + yInc * 5, tab1, tab2) self._berlin_label = self._create_label(w, 'Berlin:', yStart + yInc * 7, tab1, tab2) self._london_label = self._create_label(w, 'London:', yStart + yInc * 8, tab1, tab2) self._paris_label = self._create_label(w, 'Paris:', yStart + yInc * 9, tab1, tab2) w.show() self._timer.start(1000) exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 Minimal Window') self.setGeometry(100, 100, 640, 480) self.statusBar().showMessage('Message in statusbar.') self.show() sys.exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 Tab Example') self.setGeometry(100, 100, 640, 300) self.setCentralWidget(MyTabWidget(self)) self.show() sys.exit(app.exec())
def main(): Tag_editor = QApplication(sys.argv) view = View() model = Model() controller = Controller(view, model) view.show() sys.exit(Tag_editor.exec())
def main(): app = QApplication(sys.argv) w = QWidget() w.resize(250, 200) w.move(300, 300) w.setWindowTitle('Simple') w.show() sys.exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 Horizontal Layout') self.setGeometry(100, 100, 400, 100) self.CreateHorizontalLayout() windowLayout = QVBoxLayout() windowLayout.addWidget(self.horizontalGroupBox) self.setLayout(windowLayout) self.show() sys.exit(app.exec())
def main(): """RP Contacts main function.""" # Create the application app = QApplication(sys.argv) # Connect to the database before creating any window if not createConnection("contacts.sqlite"): sys.exit(1) # Create the main window if the connection succeeded win = Window() win.show() # Run the event loop sys.exit(app.exec())
def main(): """Main function.""" # Create an instance of `QApplication` pycalc = QApplication(sys.argv) # Show the calculator's GUI view = PyCalcUi() view.show() # Create instances of the model and the controller model = evaluateExpression PyCalcCtrl(model=model, view=view) # Execute calculator's main loop sys.exit(pycalc.exec())
def main(): """ Main code of the app. :return: Nothing. """ logger.Logger.create_log_file() app = QApplication(sys.argv) login_form = window_init.LoginWindow() # Initialized style_manager here because it doesn't work for some reasons inside the function style_manager_form = window_init.StyleManagerWindow() login_form.bRegister.clicked.connect(PyPassMan_init.MainForm.register) login_form.bLogin.clicked.connect(PyPassMan_init.MainForm.login) login_form.bRemoveAccount.clicked.connect( PyPassMan_init.MainForm.remove_acc) login_form.bStyleManager.clicked.connect( lambda: PyPassMan_init.MainForm.style_manager(style_manager_form)) login_form.show() # Checks for first run for knowing to generate encryption keys or not accounts.Checker.check_first_run() app.exec() # Prompts user after closing if there is a new version accounts.Checker.check_version()
def preview(ui_file): """ Preview the .ui file. Return the exit status to be passed back to the parent process. """ from PyQt6.QtWidgets import QApplication from .load_ui import loadUi app = QApplication([ui_file]) ui = loadUi(ui_file) ui.show() return app.exec()
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('Generic Configuration Tool') self.setGeometry(100, 100, 640, 480) self.isEdited = False self.saveAndClose = SaveAndCloseActions(self) centralWidget = QWidget() vbox = QVBoxLayout() centralWidget.setLayout(vbox) vbox.addWidget(TabContainer(self)) vbox.addStretch(1) vbox.addWidget(self.saveAndClose) self.setCentralWidget(centralWidget) self.show() sys.exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 Menu Example') self.setGeometry(100, 100, 640, 480) self.statusBar().showMessage('Message in statusbar.') # We want references to the individual menus so that # menu entries can be added to the top level menu entries. # mainMenu = self.menuBar() fileMenu = mainMenu.addMenu('&File') editMenu = mainMenu.addMenu('&Edit') viewMenu = mainMenu.addMenu('&View') searchMenu = mainMenu.addMenu('&Search') toolsMenu = mainMenu.addMenu('&Tools') self.MakeHelpMenu(mainMenu) # I have a bug here: The icon (QIcon) will not display. # I broke up the instatiation to debug this, but nothing # works. I'm using Raspbian Buster's 24x24 exit PNG file. # exitButton = QAction(QIcon('exit.png'), 'E&xit', self) exitButton.setStatusTip('Exit application') exitButton.triggered.connect(self.close) fileMenu.addAction(exitButton) # Make a toolbar. I'm using the same PNG for an icon # I tried to use on the Exit menu selection. It is # displayed here, but not there. *sigh* # exitAction = QAction(QIcon('exit.png'), 'Exit', self) exitAction.setShortcut('Alt+X') exitAction.triggered.connect(self.close) self.toolbar = self.addToolBar('Exit') self.toolbar.addAction(exitAction) self.show() sys.exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 simple button example') self.setGeometry(100, 100, 360, 140) button = QPushButton('PyQt6 Push Button', self) button.setToolTip('Click button to change window status message.') # # Not too sure about setting the fixed size of the button. # But I did that to keep the button from stretching across the width of # the window. Must be a way to have the button fit the size of it's text. # button.clicked.connect(self.on_click) button.setFixedSize(150, 30) widget = QWidget() layout = QHBoxLayout(widget) layout.addWidget(button) self.setCentralWidget(widget) self.statusBar().showMessage('Operational') self.show() sys.exit(app.exec())
def __init__(self): app = QApplication(sys.argv) super().__init__() self.setWindowTitle('PyQt6 Message Box') self.setGeometry(100, 100, 320, 200) # # Create a button that when clicked will pop up our dialog. # Connect our function on_click so that it is called when # the button is clicked. # button = QPushButton('Click to Open Message Box', self) button.setToolTip('This opens an example message box') button.clicked.connect(self.on_click) # # Add the button to the center of our simple window. # widget = QWidget() layout = QHBoxLayout(widget) layout.addWidget(button) self.setCentralWidget(widget) self.show() sys.exit(app.exec())
def main(): app = QApplication(sys.argv) ex = Example() sys.exit(app.exec())
loaded = pyqtSignal() error = pyqtSignal(str, arguments=["errorText"]) metaDataChanged = pyqtSignal() @pyqtProperty("QVariantMap", notify=metaDataChanged) def metaData(self): return self._metadata @pyqtProperty(str, notify=loaded) def definitionId(self): return self._definition_id signal.signal(signal.SIGINT, signal.SIG_DFL) file_name = None if len(sys.argv) > 1: file_name = sys.argv[1] del sys.argv[1] app = QApplication(sys.argv) engine = QQmlApplicationEngine() qmlRegisterType(DefinitionLoader, "Example", 1, 0, "DefinitionLoader") qmlRegisterType(DefinitionTreeModel.DefinitionTreeModel, "Example", 1, 0, "DefinitionTreeModel") if file_name: engine.rootContext().setContextProperty("open_file", QUrl.fromLocalFile(file_name)) engine.load(os.path.join(os.path.dirname(os.path.abspath(__file__)), "main.qml")) app.exec()
title = "PyQt6 Push Button" left = 500 top = 200 width = 300 height = 250 iconName = "home.png" self.setWindowTitle(title) self.setWindowIcon(QtGui.QIcon(iconName)) self.setGeometry(left, top, width, height) def UiComponents(self): button = QPushButton("Close Window", self) button.setGeometry(QRect(100, 100, 111, 50)) button.setIcon(QtGui.QIcon("home.png")) button.setIconSize(QSize(40, 40)) button.setToolTip("This Is Click Me Button") button.clicked.connect(ClickMe) def ClickMe(self): sys.exit() if __name__ == "__main__": App = QApplication(sys.argv) window = Window() window.UiComponents() window.show() sys.exit(App.exec())
import sys from PyQt6.QtWidgets import QApplication from services.myo_helpers import MyoService from services.ui_widget import HIMOApp if __name__ == '__main__': if not MyoService.check_if_process_running(): MyoService.start_process() app = QApplication(sys.argv) ex = HIMOApp() currentExitCode = app.exec()
def main(): app = QApplication(sys.argv) ex = Example() ex.show() app.exec()
def main(): app = QApplication(sys.argv) form = setup() form.show() app.exec()
else: pw.show() print(reason.value) def mClied(self): self.showMessage("提示", "你点了消息", self.icon) def showM(self): self.showMessage("测试", "我是消息", self.icon) def quit(self): "保险起见,为了完整的退出" self.setVisible(False) self.parent().exit() QApplication.quit() sys.exit() class window(QWidget): def __init__(self, parent=None): super(window, self).__init__(parent) ti = TrayIcon(self) ti.show() if __name__ == "__main__": app = QApplication(sys.argv) w = window() w.show() sys.exit(app.exec())
def main(): app = QApplication(sys.argv) #app = QtGui.QApplication(sys.argv) form = kSpiralCalc() form.show() app.exec()