本文整理汇总了Python中PySide.QtGui.QApplication方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QApplication方法的具体用法?Python QtGui.QApplication怎么用?Python QtGui.QApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def main():
from PySide import QtGui
from bar_widget import BarWidget
app = QtGui.QApplication(sys.argv)
widget = BarWidget()
widget.setWindowTitle('Direction Of Arrival')
widget.show()
doa = DOA()
quit_event = threading.Event()
thread = threading.Thread(target=doa.start, args=(quit_event, widget.setBars))
thread.start()
app.exec_()
quit_event.set()
thread.join()
示例2: main
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def main():
##########################################################################
##########################################################################
rospy.init_node('virtual_joystick')
rospy.loginfo('virtual_joystick started')
global x_min
global x_max
global r_min
global r_max
x_min = rospy.get_param("~x_min", -0.20)
x_max = rospy.get_param("~x_max", 0.20)
r_min = rospy.get_param("~r_min", -1.0)
r_max = rospy.get_param("~r_max", 1.0)
app = QtGui.QApplication(sys.argv)
ex = MainWindow()
sys.exit(app.exec_())
示例3: gui_fname
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def gui_fname(dir=None):
"""
Select a file via a dialog and return the file name.
"""
try:
from PyQt5.QtWidgets import QApplication, QFileDialog
except ImportError:
try:
from PyQt4.QtGui import QApplication, QFileDialog
except ImportError:
from PySide.QtGui import QApplication, QFileDialog
if dir is None:
dir = './'
app = QApplication([dir])
fname = QFileDialog.getOpenFileName(None, "Select a file...",
dir, filter="All files (*)")
if isinstance(fname, tuple):
return fname[0]
else:
return str(fname)
示例4: post_to
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def post_to(cls, receiver, func, *args, **kwargs):
"""
Post a callable to be delivered to a specific
receiver as a CallbackEvent.
It is the responsibility of this receiver to
handle the event and choose to call the callback.
"""
# We can create a weak proxy reference to the
# callback so that if the object associated with
# a bound method is deleted, it won't call a dead method
if not isinstance(func, proxy):
reference = proxy(func, quiet=True)
else:
reference = func
event = cls(reference, *args, **kwargs)
# post the event to the given receiver
QtGui.QApplication.postEvent(receiver, event)
示例5: quickModKeyAsk
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def quickModKeyAsk(self):
modifiers = QtWidgets.QApplication.queryKeyboardModifiers()
clickMode = 0 # basic mode
if modifiers == QtCore.Qt.ControlModifier:
clickMode = 1 # ctrl
elif modifiers == QtCore.Qt.ShiftModifier:
clickMode = 2 # shift
elif modifiers == QtCore.Qt.AltModifier:
clickMode = 3 # alt
elif modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier | QtCore.Qt.AltModifier:
clickMode = 4 # ctrl+shift+alt
elif modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.AltModifier:
clickMode = 5 # ctrl+alt
elif modifiers == QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier:
clickMode = 6 # ctrl+shift
elif modifiers == QtCore.Qt.AltModifier | QtCore.Qt.ShiftModifier:
clickMode = 7 # alt+shift
return clickMode
示例6: setUp
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def setUp(self):
"""setup the tests
"""
# patch anima.defaults.local_cache_folder
from anima import defaults
self.original_cache_folder = defaults.local_cache_folder
defaults.local_cache_folder = tempfile.gettempdir()
if not QtGui.QApplication.instance():
logger.debug('creating a new QApplication')
self.app = QtGui.QApplication(sys.argv)
else:
logger.debug('using the present QApplication: %s' % QtGui.qApp)
# self.app = QtGui.qApp
self.app = QtGui.QApplication.instance()
self.dialog = edl_importer.MainDialog()
self.remove_files = []
示例7: qWait
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def qWait(msec):
start = time.time()
QtGui.QApplication.processEvents()
while time.time() < start + msec * 0.001:
QtGui.QApplication.processEvents()
示例8: mkQApp
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def mkQApp():
global QAPP
if QtGui.QApplication.instance() is None:
QAPP = QtGui.QApplication([])
return QAPP
示例9: launch_gui
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def launch_gui(with_window=True):
global qApp
global browser
if IS_WIN:
freeze_support()
launch_backend()
qApp = QApplication([])
try:
browser = BrowserWindow(None)
except NoAuthTokenError as e:
print('ERROR: ' + e.message)
sys.exit(1)
browser.setupSysTray()
qApp.setQuitOnLastWindowClosed(True)
qApp.lastWindowClosed.connect(browser.shutdown)
signal.signal(
signal.SIGINT,
partial(_handle_kill, win=browser))
# Avoid code to get stuck inside c++ loop, returning control
# to python land.
timer = QtCore.QTimer()
timer.timeout.connect(lambda: None)
timer.start(500)
if with_window:
browser.show()
sys.exit(qApp.exec_())
示例10: main
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtGui.QApplication(sys.argv)
window = QtGui.QMainWindow()
# setup ui
ui = example_ui.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("QDarkStyle example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# setup stylesheet
app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
示例11: main
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def main():
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()
示例12: get_QApplication
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def get_QApplication():
"""QApplication getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QApplication
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QApplication
示例13: run
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def run():
appl = QtGui.QApplication(sys.argv)
form = MainWindow()
form.show()
appl.exec_()
示例14: QVTKRenderWidgetConeExample
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def QVTKRenderWidgetConeExample():
"""A simple example that uses the QVTKRenderWindowInteractor class."""
# every QT app needs an app
app = QtGui.QApplication(['QVTKRenderWindowInteractor'])
# create the widget
widget = QVTKRenderWindowInteractor()
widget.Initialize()
widget.Start()
# if you dont 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.SetInput(cone.GetOutput())
coneActor = vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# show the widget
widget.show()
# start event processing
app.exec_()
示例15: setupStyle
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QApplication [as 别名]
def setupStyle(self):
# global app style setting for desktop
if hostMode == "desktop":
QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create('Cleanlooks'))
self.setStyleSheet("QLineEdit:disabled{background-color: gray;}")