def main(): app = QtGui.QApplication(sys.argv) widg = QtGui.QWidget() widg.move(100, 100) pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') pgWidg = pg.GraphicsLayoutWidget() pgWidg.resize(750, 250) graph1 = pgWidg.addPlot(row=1, col=1) graph2 = pgWidg.addPlot(row=1, col=2) curve1 = graph1.plot(y=np.sin(np.linspace(1, 21, 1000)), pen='k') curve2 = graph2.plot(y=np.sin(np.linspace(1, 21, 1000)), pen='k') graph1.addItem(curve1) graph2.addItem(curve2) graph1.setMouseEnabled(x=False, y=True) graph2.setMouseEnabled(x=False, y=True) graph1Text = pg.TextItem(text='A1', color=(0, 0, 0)) graph1.addItem(graph1Text) graph1Text.setPos(150, 1) legend = graph2.addLegend() style = pg.PlotDataItem(pen='w') legend.addItem(style, 'A2') grid = QtGui.QGridLayout() grid.addWidget(pgWidg, 0, 0) widg.setLayout(grid) widg.show() sys.exit(app.exec_())
def launch(): import argparse parser = argparse.ArgumentParser(description="Visualize ASDF files.") parser.add_argument( "filename", metavar="ASDF-FILE", type=str, help="Directly open a file.", nargs="?", ) args = parser.parse_args() if args.filename and not os.path.exists(args.filename): raise ValueError(f"'{args.filename}' does not exist.") # Launch and open the window. app = QtGui.QApplication(sys.argv) # Set application name for OS - does not work on OSX but seems to work # on others. app.setApplicationName("ASDF Sextant") app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2()) # Set the application icon app_icon = QtGui.QIcon() app_icon.addFile( os.path.join(os.path.dirname(__file__), "icon.png"), QtCore.QSize(1024, 1024), ) app.setWindowIcon(app_icon) window = Window() # Move window to center of screen. window_rect = window.frameGeometry() window_rect.moveCenter(QDesktopWidget().availableGeometry().center()) window.move(window_rect.topLeft()) # Delayed file open to give some time for the javascript to catch up. if args.filename: def delayed_file_open(): time.sleep(2) window.open_file(args.filename) t = threading.Thread(target=delayed_file_open) t.start() # Show and bring window to foreground. window.show() app.installEventFilter(window) window.raise_() ret_val = app.exec_() window.__del__() os._exit(ret_val)
def main(): app = QtGui.QApplication(sys.argv) err = check.check_initial_state() if err: funcs.message_out(err) return window = mainWindow() window.show() app.exec_()
def main(): import platform if sys.platform == "linux2": QtGui.QApplication.addLibraryPath( '/usr/lib/%s-linux-gnu/qt5/plugins/' % platform.machine()) app = QtGui.QApplication(sys.argv) window = ThFrame() window.setGeometry(100, 100, 800, 600) window.setWindowTitle('ThFrame') window.show() sys.exit(app.exec_())
def launch_ui(): app = QtGui.QApplication(sys.argv) # app.setStyle(QtGui.QStyleFactory.create("Fusion")) dark_palette = palette() app.setPalette(dark_palette) main_window = ExportFile(path, file_type) # main_window = ExportFileUi() print(main_window) main_window.ui.show() app.exec_()
def __init__(self, *args, **kwrds): try: self.app = QtGui.QApplication([]) except RuntimeError: self.app = QtGui.QApplication.instance() super(Viewer, self).__init__(*args, **kwrds) self.sg = coin.SoSeparator() self.sg += [coin.SoOrthographicCamera()] self.setSceneGraph(self.sg) self.setBackgroundColor(coin.SbColor(1,1,1)) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
def main(): import sys app = QtGui.QApplication(sys.argv) glformat = QtOpenGL.QGLFormat() glformat.setVersion(3, 3) glformat.setProfile(QtOpenGL.QGLFormat.CoreProfile) w = MyWidget(glformat) w.resize(640, 480) w.show() sys.exit(app.exec_())
def show_window(standalone=False): ''' :example from tools import texture_manager reload(texture_manager) texture_manager.show_window(standalone=False) ''' if standalone: from tools.maya_publish import main app = QtGui.QApplication(sys.argv) window = main.MayaPublish() window.show() sys.exit(app.exec_()) if not standalone: from tools.maya_publish import main window = main.MayaPublish(parent=None) window.show()
return self.addressEdit.toPlainText() def sendOffers(self): return self.offersCheckBox.isChecked() def verify(self): if self.nameEdit.text() and self.addressEdit.toPlainText(): self.accept() return answer = QtGui.QMessageBox.warning( self, "Incomplete Form", "The form does not contain all the necessary information.\n" "Do you want to discard it?", QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if answer == QtGui.QMessageBox.Yes: self.reject() if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) window = MainWindow() window.resize(640, 480) window.show() window.createSample() sys.exit(app.exec_())
# import initExample from PySide2 import QtGui from pyqtgraph.Qt import QtCore, QtGui import numpy as np import pyqtgraph as pg import pyqtgraph.ptime as ptime app = QtGui.QApplication([]) ## Create window with GraphicsView widget win = pg.GraphicsLayoutWidget() win.show() ## show widget alone in its own window win.setWindowTitle('pyqtgraph example: ImageItem') view = win.addViewBox() ## lock the aspect ratio so pixels are always square # view.setAspectLocked(True) # ## Create image item img = pg.ImageItem(border='w') view.addItem(img) pos = np.array([0., 1., 0.5, 0.25, 0.75]) color = np.array([[0, 255, 255, 255], [255, 255, 0, 255], [0, 0, 0, 255], (0, 0, 255, 255), (255, 0, 0, 255)]) cmap = pg.ColorMap(pos, color) lut = cmap.getLookupTable(0.0, 1.0, 256) img.setLookupTable(lut) img.setImage(lut) # # img.setLevels([-50,40])
#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest import sys from PySide2 import QtCore, QtGui import sexton from modules.data_buffer import TestBuffer # Create an application without GUI support. This allows # tests to be run without an X server. app = QtGui.QApplication(sys.argv, QtGui.QApplication.Tty) class TestHexView(unittest.TestCase): def setUp(self): # This is run before each test_* method. self.view = sexton.HexView(None, None, False) def test_open_file(self): data_buffer = TestBuffer(10000) self.view.open(data_buffer) def test_write(self): data_buffer = TestBuffer(10000) self.view.open(data_buffer) self.view.set_cursor_position(0) self.view.write_byte_string(b'Petter')
def testBug(self): app = QtGui.QApplication([]) w = BuggyWidget() w.setup() w.show() self.assert_(True)
def main(): app = QtGui.QApplication([]) win = Ui() win.show() app.exec_()