當前位置: 首頁>>代碼示例>>Python>>正文


Python Qt.QApplication方法代碼示例

本文整理匯總了Python中PyQt4.Qt.QApplication方法的典型用法代碼示例。如果您正苦於以下問題:Python Qt.QApplication方法的具體用法?Python Qt.QApplication怎麽用?Python Qt.QApplication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.Qt的用法示例。


在下文中一共展示了Qt.QApplication方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main():        
	global verbose, samplerate, CHUNK, fftbuffersize, stream 
	probe, verbose = load_cfg()
	stream = probe.Probe()
	stream.open()
	samplerate = stream.RATE
	CHUNK = stream.CHUNK
	fftbuffersize = CHUNK

	app = Qt.QApplication(sys.argv)
	demo = FScopeDemo()
	demo.scope.plot.setDatastream(stream)
	demo.show()

	app.exec_()
	stream.close() 
開發者ID:ggventurini,項目名稱:dualscope123,代碼行數:18,代碼來源:main.py

示例2: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=control_gui, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)
    
    tb = top_block_cls()
    #connection_string = tb.sitl.connection_string()
    #print connection_string
    tb.connect_to_vehicle('udp:127.0.0.1:14562')
    tb.start()
    tb.show()

    # Connect to the Vehicle.
    #print("Connecting to vehicle on: %s" % (connection_string,))
    #vehicle = connect(connection_string, wait_ready=True)
    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:deptofdefense,項目名稱:gr-uaslink,代碼行數:25,代碼來源:control_gui_override.py

示例3: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=control_gui, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)
    
    tb = top_block_cls()
    #connection_string = tb.sitl.connection_string()
    #print connection_string
    #tb.connect_to_vehicle('udp:127.0.0.1:14552',baud_rate)
    tb.zmq_setup('tcp://127.0.0.1:14000')
    tb.start()
    tb.show()

    # Connect to the Vehicle.
    #print("Connecting to vehicle on: %s" % (connection_string,))
    #vehicle = connect(connection_string, wait_ready=True)
    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:deptofdefense,項目名稱:gr-uaslink,代碼行數:26,代碼來源:control_gui_override_mavutil.py

示例4: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=control_gui, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)
    
    tb = top_block_cls()
    #connection_string = tb.sitl.connection_string()
    #print connection_string
    #tb.connect_to_vehicle('udp:127.0.0.1:14552',baud_rate)
    tb.zmq_setup('tcp://127.0.0.1:14000')
    tb.start()
    tb.show()

    # Connect to the Vehicle.
    #print("Connecting to vehicle on: %s" % (connection_string,))
    #vehicle = connect(connection_string, wait_ready=True)
    def quitting():
        tb.running=False
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:deptofdefense,項目名稱:gr-uaslink,代碼行數:27,代碼來源:control_gui_override_control.py

示例5: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=control_gui, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:deptofdefense,項目名稱:gr-uaslink,代碼行數:19,代碼來源:control_gui_run.py

示例6: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=top_block, options=None):

    from distutils.version import StrictVersion

    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string("qtgui", "style", "raster")
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    if GUI:
        tb.show()

    def quitting():
        tb.stop()
        tb.wait()

    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:scivision,項目名稱:piradar,代碼行數:22,代碼來源:rp_eclipse.py

示例7: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=os_uhf_rx, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:esa,項目名稱:gr-opssat,代碼行數:19,代碼來源:os_uhf_rx.py

示例8: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(top_block_cls=os_demod_decode, options=None):

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)
    qapp = Qt.QApplication(sys.argv)

    tb = top_block_cls()
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:esa,項目名稱:gr-opssat,代碼行數:19,代碼來源:os_demod_decode.py

示例9: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main():
    app = QApplication(sys.argv)
    rddtDataExtractor = loadState()
    if rddtDataExtractor is None:
        rddtDataExtractor = RedditDataExtractor()
    else:
        # If something weird happened to cause currentlyDownloading to be saved as True, set it back to False
        rddtDataExtractor.currentlyDownloading = False
        # reinstantiate the praw instance because it doesn't shelve properly
        # praw shelve issue causes http.validate_certs to be uninstantiated
        rddtDataExtractor._r = praw.Reddit(user_agent='Data Extractor for reddit v1.1 by /u/VoidXC')
        rddtDataExtractor._r.http.validate_certs = 'RedditDataExtractor/cacert.pem'

    queue = Queue()
    thread = QThread()
    recv = QueueMessageReceiver(queue)
    mainGUIWindow = RddtDataExtractorGUI(rddtDataExtractor, queue, recv)

    recv.queuePutSignal.connect(mainGUIWindow.append_text)
    recv.moveToThread(thread)
    thread.started.connect(recv.run)
    # Add clean up finished signals so the threads end appropriately when the program ends
    recv.finished.connect(thread.quit)
    recv.finished.connect(recv.deleteLater)
    thread.finished.connect(thread.deleteLater)

    # start the receiver
    thread.start()
    # show the GUI
    mainGUIWindow.show()
    # display Imgur API pop up if not hidden by user and client-id isn't set
    if rddtDataExtractor.showImgurAPINotification and rddtDataExtractor.imgurAPIClientID is None:
        mainGUIWindow.notifyImgurAPI()
    # and wait for the user to exit
    sys.exit(app.exec_()) 
開發者ID:NSchrading,項目名稱:redditDataExtractor,代碼行數:37,代碼來源:main.py

示例10: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main(args=sys.argv):
    app = QApplication(args)
 
    spellEdit = SpellTextEdit()
    spellEdit.show()
 
    return app.exec_() 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:9,代碼來源:spelling.py

示例11: gnuradio_main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def gnuradio_main(samp_rate, gain, freq, block_size):
    import ctypes
    import sys
    if sys.platform.startswith('linux'):
        try:
            x11 = ctypes.cdll.LoadLibrary('libX11.so')
            x11.XInitThreads()
        except:
            print "Warning: failed to XInitThreads()"

    from distutils.version import StrictVersion
    if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"):
        style = gr.prefs().get_string('qtgui', 'style', 'raster')
        Qt.QApplication.setGraphicsSystem(style)

    qapp = Qt.QApplication([])

    tb = scope(samp_rate, gain, freq, block_size)
    tb.start()
    tb.show()

    def quitting():
        tb.stop()
        tb.wait()
    qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting)
    qapp.exec_() 
開發者ID:swkrueger,項目名稱:Thrifty,代碼行數:28,代碼來源:scope.py

示例12: __init__

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def __init__(self, *args, **kwargs):
		StatusIcon.__init__(self, *args, **kwargs)
		
		try:
			import PyQt4.Qt     as qt
			import PyQt4.QtGui  as qtgui
			import PyKDE4.kdeui as kdeui
			
			self._set_qt_types(
				QAction = qtgui.QAction,
				QMenu   = kdeui.KMenu,
				QIcon   = qtgui.QIcon,
				QImage  = qtgui.QImage,
				QPixmap = qtgui.QPixmap
			)
			
			self._status_active  = kdeui.KStatusNotifierItem.Active
			self._status_passive = kdeui.KStatusNotifierItem.Passive
		except ImportError:
			raise NotImplementedError
		
		if b"GNOME_DESKTOP_SESSION_ID" in os.environ:
			del os.environ[b"GNOME_DESKTOP_SESSION_ID"]
		# Create Qt GUI application (required by the KdeUI libraries)
		# We force "--style=motif" here to prevent Qt to load platform theme
		# integration libraries for "Gtk+" style that cause GTK 3 to abort like this:
		#   Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
		self._qt_app = qt.QApplication([sys.argv[0], "--style=motif"])
		
		# Keep reference to KMenu object to prevent SegFault...
		self._kde_menu = self._get_popupmenu()
		
		self._tray = kdeui.KStatusNotifierItem("syncthing-gtk", None)
		self._tray.setStandardActionsEnabled(False) # Prevent KDE quit item from showing
		self._tray.setContextMenu(self._kde_menu)
		self._tray.setCategory(kdeui.KStatusNotifierItem.ApplicationStatus)
		self._tray.setTitle(self.TRAY_TITLE)
		
		self._tray.activateRequested.connect(self._on_click) 
開發者ID:kozec,項目名稱:syncthing-gtk,代碼行數:41,代碼來源:statusicon.py

示例13: main

# 需要導入模塊: from PyQt4 import Qt [as 別名]
# 或者: from PyQt4.Qt import QApplication [as 別名]
def main():
    app = Qt.QApplication(sys.argv)
    read_formats = ', '.join([unicode(format).lower() \
        for format in QtGui.QImageReader.supportedImageFormats()])
    print("Qt4 plugin paths: " + unicode(list(app.libraryPaths())))
    print("Qt4 image read support: " + read_formats)
    print('Qt4 Libraries path: ' + unicode(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.LibrariesPath)))
    label = Qt.QLabel("Hello World from PyQt4", None)
    label.setWindowTitle("Hello World from PyQt4")
    label.resize(300, 300)
    label.show()
    app.exec_() 
開發者ID:Lithium876,項目名稱:ConTroll_Remote_Access_Trojan,代碼行數:14,代碼來源:test_pyqt4.py


注:本文中的PyQt4.Qt.QApplication方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。