Python pyqtgraph.Qt.QtGui.QApplication() Examples

The following are 30 code examples of pyqtgraph.Qt.QtGui.QApplication(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyqtgraph.Qt.QtGui , or try the search function .
Example #1
Source File: gui.py    From webcam-pix2pix-tensorflow with MIT License 6 votes vote down vote up
def update_stats(text):
    _window_stats_label.setText(text)

#    
#def start(sleep_s):
#    global _app, _update_timer
#    print('gui.start')
#    if update != None:
#        print('gui | Starting Update')
#        _update_timer = QtCore.QTimer()
#        _update_timer.timeout.connect(update)
#        _update_timer.start(sleep_s * 1000)
#    
#    print('gui | Starting QApplication')
#    _app.exec_()
#    
# 
Example #2
Source File: pulse_recorder.py    From DIY_particle_detector with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def close(self):
        timediff = datetime.datetime.now() - self.creation_time
        self.close_stream()
        if self.save_data and self.pcounter > 0:
            print("Saving data to file...")
            #print(self.df.to_string)
            td_str = '-'.join(str(timediff).split(':')[:2])
            _ = self.df.to_pickle(DATA_FOLDER + self.creation_time.strftime("/pulses_%Y-%m-%d_%H-%M-%S") + "___" + str(self.pcounter) + "___" + td_str + ".pkl")
            print("Saving completed.")
            print()
            print('Number of recorded waveforms:', self.pcounter, "of",self.frame_counter, "total audio frames")
            print('at least', len(self.df[self.df['ptype'] == 'alpha']) ,"alphas and") 
            print('at least', len(self.df[self.df['ptype'] == 'beta']) ,"electrons/betas were detected") 
        self.p.terminate()
        app = QtGui.QApplication([])
        app.closeAllWindows()
        app.quit()
        app.exit()
        print('done.') 
Example #3
Source File: visualization.py    From RoboND-DeepLearning-Project with MIT License 6 votes vote down vote up
def run(self):
        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
        self.img = pg.ImageItem(border='w')
        view.addItem(self.img)

        ## Set initial view bounds
        view.setRange(QtCore.QRectF(0, 0, self.image_hw, self.image_hw))

        timer = QtCore.QTimer()
        timer.timeout.connect(self._update)
        timer.start(50)

        app.exec_() 
Example #4
Source File: readData_AWR1642.py    From AWR1642-Read-Data-Python-MMWAVE-SDK-2 with MIT License 6 votes vote down vote up
def update():
     
    dataOk = 0
    global detObj
    x = []
    y = []
      
    # Read and parse the received data
    dataOk, frameNumber, detObj = readAndParseData16xx(Dataport, configParameters)
    
    if dataOk and len(detObj["x"])>0:
        #print(detObj)
        x = -detObj["x"]
        y = detObj["y"]
        
        s.setData(x,y)
        QtGui.QApplication.processEvents()
    
    return dataOk


# -------------------------    MAIN   -----------------------------------------  

# Configurate the serial port 
Example #5
Source File: DriverVitalSignsLab.py    From AWR1642-Read-Data-Python-MMWAVE-SDK-2 with MIT License 6 votes vote down vote up
def update():
     
    dataOk = 0
    global vitalSignsObj, heartRateMat, frameMat
      
    # Read and parse the received data
    dataOk, frameNumber, vitalSignsObj = readAndParseVitalSigns(Dataport, configParameters)
    
    if dataOk:
        #print(vitalSignsObj)
        frameMat.append(frameNumber)
        heartRateMat.append(vitalSignsObj["heartRateEst_FFT"])
        
        s.setData(frameMat,heartRateMat)
        QtGui.QApplication.processEvents()
    
    return dataOk


# -------------------------    MAIN   -----------------------------------------  

# Configurate the serial port 
Example #6
Source File: visualization.py    From RoboND-DeepLearning-Project with MIT License 6 votes vote down vote up
def run(self):
        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
        self.img = pg.ImageItem(border='w')
        view.addItem(self.img)

        ## Set initial view bounds
        view.setRange(QtCore.QRectF(0, 0, 2*self.image_hw, self.image_hw))

        timer = QtCore.QTimer()
        timer.timeout.connect(self._update)
        timer.start(50)

        app.exec_() 
Example #7
Source File: vumeter.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _start():
    '''Start the module
    This uses the global variables from setup and adds a set of global variables
    '''
    global parser, args, config, r, response, patch, name
    global monitor, delay, winx, winy, winwidth, winheight, input_name, input_variable, variable, app, window, timer

    # this can be used to show parameters that have changed
    monitor = EEGsynth.monitor(name=name, debug=patch.getint('general', 'debug'))

    # get the options from the configuration file
    delay           = patch.getfloat('general', 'delay')
    winx            = patch.getfloat('display', 'xpos')
    winy            = patch.getfloat('display', 'ypos')
    winwidth        = patch.getfloat('display', 'width')
    winheight       = patch.getfloat('display', 'height')

    # get the input options
    input_name, input_variable = list(zip(*config.items('input')))

    for name,variable in zip(input_name, input_variable):
        monitor.info("%s = %s" % (name, variable))

    # start the graphical user interface
    app = QtGui.QApplication(sys.argv)
    signal.signal(signal.SIGINT, _stop)

    window = Window()
    window.show()

    # Set timer for update
    timer = QtCore.QTimer()
    timer.timeout.connect(_loop_once)
    timer.setInterval(10)            # timeout in milliseconds
    timer.start(int(delay * 1000))   # in milliseconds

    # there should not be any local variables in this function, they should all be global
    if len(locals()):
        print('LOCALS: ' + ', '.join(locals().keys())) 
Example #8
Source File: plottrigger.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _loop_forever():
    '''Run the main loop forever
    '''
    QtGui.QApplication.instance().exec_() 
Example #9
Source File: vumeter.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _loop_forever():
    '''Run the main loop forever
    '''
    QtGui.QApplication.instance().exec_() 
Example #10
Source File: vumeter.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _stop(*args):
    '''Stop and clean up on SystemExit, KeyboardInterrupt
    '''
    QtGui.QApplication.quit() 
Example #11
Source File: inputcontrol.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _loop_forever():
    '''Run the main loop forever
    '''
    QtGui.QApplication.instance().exec_() 
Example #12
Source File: plotspectral.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _loop_forever():
    '''Run the main loop forever
    '''
    QtGui.QApplication.instance().exec_() 
Example #13
Source File: plotspectral.py    From eegsynth with GNU General Public License v3.0 5 votes vote down vote up
def _stop(*args):
    '''Stop and clean up on SystemExit, KeyboardInterrupt
    '''
    QtGui.QApplication.quit() 
Example #14
Source File: gui.py    From audio-reactive-led-strip with MIT License 5 votes vote down vote up
def __init__(self, width=800, height=450, title=''):
        # Create GUI window
        self.app = QtGui.QApplication([])
        self.win = pg.GraphicsWindow(title)
        self.win.resize(width, height)
        self.win.setWindowTitle(title)
        # Create GUI layout
        self.layout = QtGui.QVBoxLayout()
        self.win.setLayout(self.layout) 
Example #15
Source File: __main__.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 5 votes vote down vote up
def run():
    app = QtGui.QApplication([])
    loader = ExampleLoader()

    app.exec_() 
Example #16
Source File: amination.py    From video-to-pose3D with MIT License 5 votes vote down vote up
def __init__(self, input_video):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 45.0  ## distance of camera from center
        self.w.opts['fov'] = 60  ## horizontal field of view in degrees
        self.w.opts['elevation'] = 10  ## camera's angle of elevation in degrees 仰俯角
        self.w.opts['azimuth'] = 90  ## camera's azimuthal angle in degrees 方位角
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(450, 700, 980, 700)  # 原点在左上角
        self.w.show()

        # create the background grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(-10, 0, 0)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -10, 0)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(0, 0, -10)
        self.w.addItem(gz)

        # special setting
        self.cap = cv2.VideoCapture(input_video)
        self.video_name = input_video.split('/')[-1].split('.')[0]
        self.kpt2Ds = []
        pos = pos_init

        for j, j_parent in enumerate(common.skeleton_parents):
            if j_parent == -1:
                continue

            x = np.array([pos[j, 0], pos[j_parent, 0]]) * 10
            y = np.array([pos[j, 1], pos[j_parent, 1]]) * 10
            z = np.array([pos[j, 2], pos[j_parent, 2]]) * 10 - 10
            pos_total = np.vstack([x, y, z]).transpose()
            self.traces[j] = gl.GLLinePlotItem(pos=pos_total, color=pg.glColor((j, 10)), width=6, antialias=True)
            self.w.addItem(self.traces[j]) 
Example #17
Source File: amination.py    From video-to-pose3D with MIT License 5 votes vote down vote up
def start(self):
        if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
            QtGui.QApplication.instance().exec_() 
Example #18
Source File: videoThenAmination.py    From video-to-pose3D with MIT License 5 votes vote down vote up
def __init__(self, skeletons_3d):
        self.traces = dict()
        self.app = QtGui.QApplication(sys.argv)
        self.w = gl.GLViewWidget()
        self.w.opts['distance'] = 45.0  ## distance of camera from center
        self.w.opts['fov'] = 60  ## horizontal field of view in degrees
        self.w.opts['elevation'] = 10  ## camera's angle of elevation in degrees 仰俯角
        self.w.opts['azimuth'] = 90  ## camera's azimuthal angle in degrees 方位角
        self.w.setWindowTitle('pyqtgraph example: GLLinePlotItem')
        self.w.setGeometry(450, 700, 980, 700)  # 原点在左上角
        self.w.show()

        # create the background grids
        gx = gl.GLGridItem()
        gx.rotate(90, 0, 1, 0)
        gx.translate(-10, 0, 0)
        self.w.addItem(gx)
        gy = gl.GLGridItem()
        gy.rotate(90, 1, 0, 0)
        gy.translate(0, -10, 0)
        self.w.addItem(gy)
        gz = gl.GLGridItem()
        gz.translate(0, 0, -10)
        self.w.addItem(gz)

        # special setting
        pos = pos_init
        self.skeleton_parents = common.skeleton_parents
        self.skeletons_3d = skeletons_3d

        for j, j_parent in enumerate(self.skeleton_parents):
            if j_parent == -1:
                continue
            x = np.array([pos[j, 0], pos[j_parent, 0]]) * 10
            y = np.array([pos[j, 1], pos[j_parent, 1]]) * 10
            z = np.array([pos[j, 2], pos[j_parent, 2]]) * 10 - 10
            pos_total = np.vstack([x, y, z]).transpose()
            self.traces[j] = gl.GLLinePlotItem(pos=pos_total, color=pg.glColor((j, 10)), width=6, antialias=True)
            self.w.addItem(self.traces[j]) 
Example #19
Source File: videoThenAmination.py    From video-to-pose3D with MIT License 5 votes vote down vote up
def start(self):
        if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
            QtGui.QApplication.instance().exec_() 
Example #20
Source File: runRealtimeGCCNMF.py    From gcc-nmf with MIT License 5 votes vote down vote up
def run(self, params):
        try:
            from pyqtgraph.Qt import QtGui
            from gccNMF.realtime.gccNMFInterface import RealtimeGCCNMFInterfaceWindow
            
            app = QtGui.QApplication([])
            gccNMFInterfaceWindow = RealtimeGCCNMFInterfaceWindow(params.audioPath, params.numTDOAs, params.gccPHATNLAlpha, params.gccPHATNLEnabled, params.dictionariesW, params.dictionarySize,
                                                                  params.dictionarySizes, params.dictionaryType, params.numHUpdates, params.localizationEnabled, params.localizationWindowSize,
                                                                  self.gccPHATHistory, self.tdoaHistory, self.inputSpectrogramHistory, self.outputSpectrogramHistory, self.coefficientMaskHistories,
                                                                  self.togglePlayAudioProcessQueue, self.togglePlayAudioProcessAck,
                                                                  self.togglePlayGCCNMFProcessQueue, self.togglePlayGCCNMFProcessAck,
                                                                  self.tdoaParamsGCCNMFProcessQueue, self.tdoaParamsGCCNMFProcessAck,
                                                                  self.toggleSeparationGCCNMFProcessQueue, self.toggleSeparationGCCNMFProcessAck)
            app.exec_()
            logging.info('Window closed')
            self.terminateEvent.set()
    
            self.audioProcess.join()
            logging.info('Audio process joined')
            
            self.gccNMFProcess.join()
            logging.info('GCCNMF process joined')
        
        finally:
            self.audioProcess.terminate()
            self.gccNMFProcess.terminate() 
Example #21
Source File: batchviewer.py    From BatchViewer with Apache License 2.0 5 votes vote down vote up
def view_batch(*args, width=300, height=300, lut={}):
    use_these = args
    if not isinstance(use_these, (np.ndarray, np.memmap)):
        use_these = list(use_these)
        for i in range(len(use_these)):
            item = use_these[i]
            try:
                import torch
                if isinstance(item, torch.Tensor):
                    item = item.detach().cpu().numpy()
            except ImportError:
                pass
            while len(item.shape) < 4:
                item = item[None]
            use_these[i] = item
        use_these = np.concatenate(use_these, 0)
    else:
        while len(use_these.shape) < 4:
            use_these = use_these[None]

    global app
    app = QtGui.QApplication.instance()
    if app is None:
        app = QtGui.QApplication(sys.argv)
    sv = BatchViewer(width=width, height=height)
    sv.setBatch(use_these, lut)
    sv.show()
    app.exit(app.exec_()) 
Example #22
Source File: webcam3d.py    From tf-pose with Apache License 2.0 5 votes vote down vote up
def start(self):
        """
        get the graphics window open and setup
        """
        if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
            QtGui.QApplication.instance().exec_() 
Example #23
Source File: __main__.py    From tf-pose with Apache License 2.0 5 votes vote down vote up
def run():
    app = QtGui.QApplication([])
    loader = ExampleLoader()

    app.exec_() 
Example #24
Source File: widgets.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def mouseDoubleClickEvent(self, event, *args, **kwargs):
        print('label double clicked')
        self.win = CurveModifyWin(self.id, self.mainwindow)
        self.win.sigCurveChanged.connect(self.callback_sigchanged)
        self.win.show()
        QtGui.QApplication.processEvents()
        time.sleep(0.2) 
Example #25
Source File: analysis.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def _translate(context,  text,  disambig):
        return QtGui.QApplication.translate(context,  text,  disambig,  _encoding) 
Example #26
Source File: analysis.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def _translate(context,  text,  disambig):
        return QtGui.QApplication.translate(context,  text,  disambig) 
Example #27
Source File: analysis.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def show_curve_property_diag(id, parent):
    def func(event):
        print('curve was double clicked')
        print(event)
        win = CurveModifyWin(id, parent)
        win.show()
        QtGui.QApplication.processEvents()
        print('end')
        
    return func 
Example #28
Source File: analysis.py    From pyFlightAnalysis with MIT License 5 votes vote down vote up
def main():
    def func():
        print(app.focusWidget())
    app = QtGui.QApplication(sys.argv)
    app.focusChanged.connect(func)
    mainwin = MainWindow()
    mainwin.show()
    print(app.focusWidget())
    sys.exit(app.exec_()) 
Example #29
Source File: picopyscope.py    From picosdk-python-examples with ISC License 5 votes vote down vote up
def main():
    app = QtGui.QApplication([])
    win = PicoPyScope(app)
    win.show()
    # debug = pg.dbg()
    try:
        sys.exit(app.exec_())
    except Exception as ex:
        print "main:", ex.message 
Example #30
Source File: peopleCountingDemo.py    From AWR1642-Read-Data-Python-MMWAVE-SDK-2 with MIT License 5 votes vote down vote up
def update():
     
    dataOk = 0
    targetDetected = 0
    global targetObj
    global pointObj
    x = []
    y = []
      
    # Read and parse the received data
    dataOk, targetDetected, frameNumber, targetObj, pointObj = readAndParseData16xx(Dataport, configParameters)
    
    if targetDetected:
        print(targetObj)
        print(targetObj["numTargets"])
        x = -targetObj["posX"]
        y = targetObj["posY"]
        s2.setData(x,y)
        QtGui.QApplication.processEvents()
        
    if dataOk: 
        x = -pointObj["range"]*np.sin(pointObj["azimuth"])
        y = pointObj["range"]*np.cos(pointObj["azimuth"])
        
        s1.setData(x,y)
        QtGui.QApplication.processEvents()
    
    return dataOk


# -------------------------    MAIN   -----------------------------------------  

# Configurate the serial port