本文整理汇总了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()
示例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_()
示例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_()
示例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_()
示例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_()
示例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_()
示例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_()
示例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_()
示例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_())
示例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_()
示例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_()
示例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)
示例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_()