def main() -> None: """Mainline for interactive review of layout.""" app = QApplication(sys.argv) win = MainWin() win.exit_action.triggered.connect(sys.exit) win.show() app.exec_()
def run(): app = QApplication(sys.argv) ruler = Ruler() ruler.show() app.exec_()
def main(): app = QApplication([]) QtWebEngine.initialize() engine = QQmlApplicationEngine() qml_file_path = os.path.join(os.path.dirname(__file__), 'browser.qml') qml_url = QUrl.fromLocalFile(os.path.abspath(qml_file_path)) engine.load(qml_url) app.exec_()
def explore_signature_library(sig_trie): """ Display an in-memory signature trie in the signature explorer GUI. :param sig_trie: instance of `TrieNode` """ if not QApplication.instance(): app = QApplication(sys.argv) else: app = None widget = App() widget.show() widget.open_trie(sig_trie, '(memory)') if app: app.exec_()
def QVTKRenderWidgetConeExample(): """A simple example that uses the QVTKRenderWindowInteractor class.""" from vtkmodules.vtkFiltersSources import vtkConeSource from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper, vtkRenderer # load implementations for rendering and interaction factory classes import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle # every QT app needs an app app = QApplication(['QVTKRenderWindowInteractor']) window = QMainWindow() # create the widget widget = QVTKRenderWindowInteractor(window) window.setCentralWidget(widget) # if you don't want the 'q' key to exit comment this. widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit()) ren = vtkRenderer() widget.GetRenderWindow().AddRenderer(ren) cone = vtkConeSource() cone.SetResolution(8) coneMapper = vtkPolyDataMapper() coneMapper.SetInputConnection(cone.GetOutputPort()) coneActor = vtkActor() coneActor.SetMapper(coneMapper) ren.AddActor(coneActor) # show the widget window.show() widget.Initialize() widget.Start() # start event processing # Source: https://doc.qt.io/qtforpython/porting_from2.html # 'exec_' is deprecated and will be removed in the future. # Use 'exec' instead. try: app.exec() except AttributeError: app.exec_()
def run(optimiser): app = QApplication(sys.argv) # Thread for running slow parts of the optimiser without pausing GUI opt_worker = OptWorker(optimiser) opt_thread = QThread() opt_worker.moveToThread(opt_thread) app.aboutToQuit.connect(opt_thread.quit) opt_thread.start() # Queue and thread for updating text field queue = Queue() sys.stdout = WriteStream(queue) window = BayesOptWindow(optimiser, opt_worker) window.show() write_thread = QThread() receiver = Receiver(queue) receiver.signal.connect(window.write_to_textfield) receiver.moveToThread(write_thread) write_thread.started.connect(receiver.run) app.aboutToQuit.connect(write_thread.quit) write_thread.start() # app.exec_() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) app.setOrganizationName("ecosongs") app.setOrganizationDomain("https://github.com/vin985/pysoundplayer") app.setApplicationName("pysoundplayer") example = SpectrogramViewerExample() example.load_file("example.wav") tag1 = { "start": 1.5, "end": 3, "text": "this is a test", "border_color": "#ff0000", "fill_color": "#00ff00", "text_fontsize": 24, } tag2 = { "start": 10, "end": 20, "min_freq": 1000, "max_freq": 5000, "text": "frequency test", # "text_color": "#000000", "color": "#ff00ff", } example.spectrogram_viewer.draw_annotation(tag1) example.spectrogram_viewer.draw_annotation(tag2) example.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) main_window = MainWindow() main_window.show() sys.exit(app.exec_())
def run(): # Be able to close with Ctrl+C in the terminal once Qt is started https://stackoverflow.com/a/5160720 signal.signal(signal.SIGINT, signal.SIG_DFL) arguments = sys.argv # Remove warning about invalid style override arguments.extend(['-style', 'Fusion']) app = QApplication(arguments) apply_dark_theme(app) # Show splash screen pixmap = QPixmap(':/icons/splash.png') splash = QSplashScreen(pixmap) splash.setWindowTitle('The Little Hat') splash.showMessage('loading...', alignment=Qt.AlignBottom | Qt.AlignCenter, color=Qt.white) splash.show() app.processEvents() window = MainWindow(app) window.show() splash.finish(window) return app.exec_()
def cli(ctx, config, verbose, no_color, option): """ Initialises the cli grouping with default options. """ ctx.ensure_object(dict) init_logging(verbose, no_color, config) options = dict(option) ctx.obj["config"] = Config( config_path=config, argv={k: yaml.load(v, yaml.SafeLoader) for k, v in options.items()}, env=os.environ, ) if ctx.invoked_subcommand is None: app = QApplication(sys.argv) widget = MainWindow(ctx.obj["config"], lambda p: init_logging(verbose, no_color, p)) widget.show() sys.exit(app.exec_())
def main(): # initialize app = QApplication([]) # create connection to the server client = Client(address=('127.0.0.1', 8888), debug=True) client.client_connect() # create a main window window = MainWindow(window_width=400, window_height=600) window.setWindowTitle("Python chat") # waiting for messages global client_worker, network_thread # TODO: refactor this network_thread = QThread() network_thread.setTerminationEnabled(True) client_worker = ClientWorker(client_socket=client.client()) client_worker.recieved_message.connect(window.recieved_message_handler) client_worker.moveToThread(network_thread) network_thread.started.connect(client_worker.start) network_thread.start() window.show() return app.exec_()
def main_app(base_path, file, file_config): """Run the GUI of xBan The function initiates and resize the application """ app = QApplication(sys.argv) if hasattr(QStyleFactory, "AA_UseHighDpiPixmaps"): app.setAttribute(Qt.AA_UseHighDpiPixmaps) with open(os.path.join(base_path, "xBanStyle.css"), "r") as style_sheet: style = style_sheet.read() app.setWindowIcon(QIcon(os.path.join(base_path, "xBanUI.png"))) xBanApp = xBanWindow(base_path, file, file_config) xBanApp.setStyleSheet(style) # resize and move screen to center primary_screen = QGuiApplication.primaryScreen() if primary_screen: screen_size = primary_screen.availableSize() xBanApp.resize(screen_size.width() / 3, screen_size.height() / 2) xBanApp.move( (screen_size.width() - xBanApp.width()) / 2, (screen_size.height() - xBanApp.height()) / 2, ) app.setStyle("Fusion") sys.exit(app.exec_()) else: main_logger.error("Primary screen not found")
def draw(game): app = QApplication() widget = MyWidget(game) widget.resize(800, 600) widget.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) app.setStyle('Fusion') ex = MainWindow() ex.show() print("here goes") sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) window = MainWindow() window.show() # exit code == PySide returned val sys.exit(app.exec_())
def main(): import sys pg.setConfigOptions(antialias=True) app = QApplication(sys.argv) mainwindow = MainWindow() mainwindow.show() sys.exit(app.exec_())
def __init__(self): """Show the main application window""" app = QApplication(sys.argv) # Open the main window self._main_window = SimilaritiesWindow() self._main_window.show() self._main_window.do_show_loaded_songs_gui_action() # Quit when the user exits the program sys.exit(app.exec_())
def main(): """main function """ app = QApplication(sys.argv) ui = main_ui.Ui_MainWindow() window = MainWindow(app, ui) atexit.register(window._exit) window.show() sys.exit(app.exec_())
def test(): import sys from PySide6.QtWidgets import QApplication app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
def test(): import sys from PySide6.QtWidgets import QApplication app = QApplication(sys.argv) win = QMainWindow() MainWindowUI().setup_ui(win) win.show() sys.exit(app.exec_())
def main() -> None: logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.DEBUG) # get config parser = ArgumentParser() parser.add_argument('--config', help='configuration file', default='config.ini') args = parser.parse_args() # run application app = QApplication([]) widget = EvelynDesktop(args.config) widget.show() sys.exit(app.exec_())
def main(): """Main.""" voice = composition.Voice("test", music21.scale.MajorScale("D"), 12, "tenor") voice.compose() print(str(voice)) # Run interface app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
def main(): """Main Entry Point.""" LOG = logging.getLogger("{{ cookiecutter.project_slug }}") LOG.setLevel(logging.DEBUG) Q_APP = QApplication([]) APP = Application() LOG.info("Application Version: v{}".format(__version__)) APP.show() sys.exit(Q_APP.exec_())
def main(): """Main Loop.""" print(__doc__ + __version__ + __url__) application = QApplication(sys.argv) application.setApplicationName("pyvoicechanger") application.setOrganizationName("pyvoicechanger") application.setOrganizationDomain("pyvoicechanger") application.setWindowIcon(QIcon.fromTheme("audio-input-microphone")) application.aboutToQuit.connect( lambda: call('killall rec ; killall play', shell=True)) mainwindow = MainWindow() mainwindow.show() sys.exit(application.exec_())
def create_gui(icon): """Create and show the GUI Application""" app = QApplication() app.setApplicationName('Importador BGG -> Ludopedia') app.setApplicationVersion('v0.4') app.setWindowIcon(QIcon(icon)) importer = Importador() importer.show() importer.raise_() importer.setVisible(True) importer.resize(500, 400) sys.exit(app.exec_())
def main(): parser = argparse.ArgumentParser(prog=videotrackr_name) parser.add_argument('video_file', metavar='video_file', type=str, nargs='?', help='Video file to use') parser.add_argument('--debug', help='Enable debug mode', action='store_true') args = parser.parse_args() app = QApplication([]) form = main_controller(args.debug) form.show() sys.exit(app.exec_())
def main(argv: typing.List[str]): qInstallMessageHandler(lambda x, y, msg: print(msg)) #vm=AppViewModel() app = QApplication(sys.argv) window = MainWindow() window.show() # # view=QListView() # model=QStringListModel(['1','2']) # view.setModel(model) # # model.setStringList(['4','5']) # view.show() sys.exit(app.exec_())
if __name__ == '__main__': parser = ArgumentParser(description="contextinfo", formatter_class=RawTextHelpFormatter) parser.add_argument('--gles', '-g', action='store_true', help='Use OpenGL ES') parser.add_argument('--software', '-s', action='store_true', help='Use Software OpenGL') parser.add_argument('--desktop', '-d', action='store_true', help='Use Desktop OpenGL') options = parser.parse_args() if options.gles: QCoreApplication.setAttribute(Qt.AA_UseOpenGLES) elif options.software: QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL) elif options.desktop: QCoreApplication.setAttribute(Qt.AA_UseDesktopOpenGL) app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() mainWindow.updateDescription() sys.exit(app.exec_())
def _tick(self): """ Tick the world simulation. """ self._ticks += 1 self._world.update(self._ticks) self._wator_widget.repaint() self._wator_graph.repaint() fish, sharks = self._world.stats() if fish == 0 and sharks == 0: print("Both sharks and fish have become extinct.") self.pause() elif fish == 0 and sharks > 0: print("No more fish. Wa-Tor is overrun with sharks.") self.pause() elif sharks == 0: print("No more sharks. Wa-Tor will become overrun with fish.") self.pause() if __name__ == "__main__": # Create the Qt Application APP = QApplication(sys.argv) APP.setWindowIcon(QIcon("res/icon_wator.png")) # Create and show the form MAIN = MainWindow() MAIN.show() # Run the main Qt loop sys.exit(APP.exec_())
(screen[3] / 2) - (win[3] / 2), 0, 0) start_in_tray = 'False' # open app setting try: current_directory = str(pathlib.Path(__file__).parent.absolute()) setting_file = current_directory + '/setting.txt' fileob = open(setting_file, 'r') setting_lines = fileob.readlines() start_in_tray = setting_lines[0].split(':')[1].strip() # if open_in_tray == 'False': # # self.hide() # print('showing window') # window.show() fileob.close() except FileNotFoundError: print('error load setting') if start_in_tray == 'False': window.show() else: window.show() window.hide() window.runningme() app.exec_() os._exit(0) # sys.exit()