本文整理汇总了Python中PyQt4.QtGui.QApplication方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QApplication方法的具体用法?Python QtGui.QApplication怎么用?Python QtGui.QApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyReleaseEvent
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def keyReleaseEvent(self,e):
# Ctrl key changes mouse cursor
if e.key() == QtCore.Qt.Key_Control:
QtGui.QApplication.restoreOverrideCursor()
# check for zero to release temporary zero
# somehow, for the numpad key in some machines, a check on Insert is needed aswell
elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert:
self.transpTempZero = False
self.update()
#############################
## Little helper methods
#############################
# Helper method that sets tooltip and statustip
# Provide an QAction and the tip text
# This text is appended with a hotkeys and then assigned
示例2: main
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
# This is a very important solution
# for the problem in the IPython console.
app_main = 0
# ---------------------------------------------------------------------- #
app_main = QtGui.QApplication(
sys.argv,
QtCore.Qt.WindowStaysOnTopHint
)
app_main.processEvents()
# Show Main Window
tra_ticket_booker = TraTicketBooker()
tra_ticket_booker.show()
sys.exit(app_main.exec_())
tra_ticket_booker.driver.quit()
示例3: get_code
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def get_code(url, size=(640, 480), title="Google authentication"):
"""Open a QT webkit window and return the access code."""
app = QtGui.QApplication([])
dialog = QtGui.QDialog()
dialog.setWindowTitle(title)
dialog.resize(*size)
webview = QtWebKit.QWebView()
webpage = QtWebKit.QWebPage()
webview.setPage(webpage)
webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview))
webview.setUrl(QtCore.QUrl.fromEncoded(url))
layout = QtGui.QGridLayout()
layout.addWidget(webview)
dialog.setLayout(layout)
dialog.authorization_code = None
dialog.show()
app.exec_()
return dialog.authorization_code
示例4: retranslateUi
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Sparta v0.0001", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_5), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_6), QtGui.QApplication.translate("MainWindow", "Information", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_7), QtGui.QApplication.translate("MainWindow", "Notes", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Hosts", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Scan", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Brute", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_8), QtGui.QApplication.translate("MainWindow", "Log", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_9), QtGui.QApplication.translate("MainWindow", "Terminal", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_10), QtGui.QApplication.translate("MainWindow", "Python", None, QtGui.QApplication.UnicodeUTF8))
self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
self.actionNew_Project.setText(QtGui.QApplication.translate("MainWindow", "New", None, QtGui.QApplication.UnicodeUTF8))
self.actionNew_Project.setToolTip(QtGui.QApplication.translate("MainWindow", "Create a new project file", None, QtGui.QApplication.UnicodeUTF8))
self.actionNew_Project.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8))
self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "Exit", None, QtGui.QApplication.UnicodeUTF8))
self.actionExit.setToolTip(QtGui.QApplication.translate("MainWindow", "Exit the application", None, QtGui.QApplication.UnicodeUTF8))
self.actionExit.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Q", None, QtGui.QApplication.UnicodeUTF8))
self.actionOpen.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8))
self.actionOpen.setToolTip(QtGui.QApplication.translate("MainWindow", "Open an existing project file", None, QtGui.QApplication.UnicodeUTF8))
self.actionOpen.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
示例5: run
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def run():
"""
Main function that executes the app.
"""
app = QtGui.QApplication(sys.argv)
# Initialize the database
createDB()
# Start the app
GUI = Window()
GUI.show()
sys.exit(app.exec_())
# Run the app
示例6: gui_fname
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.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)
示例7: mainPyQt4Simple
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def mainPyQt4Simple():
# 必要なモジュールのimport
from PyQt4.QtCore import QUrl
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebView
url = 'https://github.com/tody411/PyIntroduction'
app = QApplication(sys.argv)
# QWebViewによるWebページ表示
browser = QWebView()
browser.load(QUrl(url))
browser.show()
sys.exit(app.exec_())
## PyQt4でのWebブラウザー作成(Youtube用).
示例8: mainPyQt5
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def mainPyQt5():
# 必要なモジュールのimport
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
url = 'https://github.com/tody411/PyIntroduction'
app = QApplication(sys.argv)
# QWebEngineViewによるWebページ表示
browser = QWebEngineView()
browser.load(QUrl(url))
browser.show()
sys.exit(app.exec_())
示例9: main
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
try:
from PyQt4.Qt import PYQT_VERSION_STR
from nmap import __version__
from fpdf import __version__
from requests import __version__
except ImportError as e:
from PyQt4.Qt import PYQT_VERSION_STR
from nmap import __version__
from fpdf import __version__
from requests import __version__
print e
exit(-1)
from PyQt4.QtGui import QApplication
from rexploit.controllers.maincontroller import MainController
app = QApplication(argv)
mainController = MainController()
mainController.start()
exit(app.exec_())
示例10: ImageView
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def ImageView(args):
print("imageView")
try:
import PyQt4.QtGui as QtGui
except ImportError:
sys.exit("Using --imageViewer requires PyQt4, which is not installed.")
from FlashAir import ImageViewer
app = QtGui.QApplication(sys.argv)
port=args.card_uri.port
if(port == None):
port = 80
imageViewer = ImageViewer.ImageViewer(socket.gethostbyname(args.card_uri.hostname), port, args.timeout, args.folder_local, args.folder_remote, args.instant, args.recursive, args.debug_image)
imageViewer.show()
sys.exit(app.exec_())
示例11: post_to
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.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)
示例12: InterIdentify
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def InterIdentify(xarr, specarr, slines, sfluxes, ws, mdiff=20, wdiff=20, rstep=1, filename=None,
function='poly', order=3, sigma=3, smooth=0, niter=5, res=2, dres=0.1, dc=20, ndstep=20,
istart=None, method='Zeropoint', scale='zscale', cmap='gray', contrast=1.0,
subback=0, textcolor='green', log=None, verbose=True):
# Create GUI
App = QtGui.QApplication(sys.argv)
aw = InterIdentifyWindow(xarr, specarr, slines, sfluxes, ws, rstep=rstep, mdiff=mdiff, wdiff=wdiff, sigma=sigma, niter=niter,
res=res, dres=dres, dc=dc, ndstep=ndstep, istart=istart, method=method, smooth=smooth,subback=subback,
cmap=cmap, scale=scale, contrast=contrast, filename=filename, textcolor=textcolor, log=log)
aw.show()
# Start application event loop
exit = App.exec_()
imsol = aw.main.ImageSolution.copy()
# Check if GUI was executed succesfully
if exit != 0:
raise SpecError(
'InterIdentify GUI has unexpected exit status ' +
str(exit))
del aw
return imsol
示例13: main
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
app = QtGui.QApplication(sys.argv)
main = Main(app)
main.show()
sys.exit(app.exec_())
示例14: main
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def main():
app = QtGui.QApplication(sys.argv)
sniffer = SnifferUI()
sniffer.show()
sys.exit(app.exec_())
示例15: keyPressEvent
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QApplication [as 别名]
def keyPressEvent(self,e):
# Ctrl key changes mouse cursor
if e.key() == QtCore.Qt.Key_Control:
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
# Backspace deletes last point from polygon
elif e.key() == QtCore.Qt.Key_Backspace:
if not self.drawPolyClosed:
del self.drawPoly[-1]
self.update()
# set alpha to temporary zero
elif e.key() == QtCore.Qt.Key_0:
self.transpTempZero = True
self.update()
elif e.key() == QtCore.Qt.Key_E:
self.select_next_correction()
elif e.key() == QtCore.Qt.Key_R:
self.select_previous_correction()
elif e.key() == QtCore.Qt.Key_1:
self.modify_correction_type(CorrectionBox.types.TO_CORRECT)
elif e.key() == QtCore.Qt.Key_2:
self.modify_correction_type(CorrectionBox.types.TO_REVIEW)
elif e.key() == QtCore.Qt.Key_3:
self.modify_correction_type(CorrectionBox.types.RESOLVED)
elif e.key() == QtCore.Qt.Key_4:
self.modify_correction_type(CorrectionBox.types.QUESTION)
elif e.key() == QtCore.Qt.Key_D and self.config.correctionMode:
self.delete_selected_annotation()
elif e.key() == QtCore.Qt.Key_M and self.config.correctionMode:
self.modify_correction_description()
# Key released