当前位置: 首页>>代码示例>>Python>>正文


Python QAction.setStatusTip方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QAction.setStatusTip方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setStatusTip方法的具体用法?Python QAction.setStatusTip怎么用?Python QAction.setStatusTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QAction的用法示例。


在下文中一共展示了QAction.setStatusTip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_action_helper

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
def make_action_helper(self, text, help_text, shortcut: QShortcut=None,
                       icon_path=None):
    """
    Builds an action.

    Idea from "Rapid GUI Programming with Python and Qt" by Mark Summerfield
        Published:  Jun 2008
        Publisher:  Prentice Hall

    :param text: Short text for description of action.
    :param help_text: Longer description for action.
    :param shortcut: Shortcut key combination for action.
    :param icon_path: Path of icon for action
    :return: built action as QAction
    """
    if icon_path is not None:
        action = QAction(QIcon(icon_path), text, self)
    else:
        action = QAction(text, self)
    if shortcut:
        action.setShortcut(shortcut)

    action.setToolTip(help_text)
    action.setStatusTip(help_text)
    logging.debug("Action set for " + str(type(self)) + ": " + text + " " + str(shortcut))

    return action
开发者ID:aparaatti,项目名称:definator,代码行数:29,代码来源:qt_helper_functions.py

示例2: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self, width, height):  # Initialize the window
        self.setToolTip('This is a <b>QWidget</b> widget')

        btn = QPushButton('Button', self)
        btn.setToolTip('This is a <b>QPushButton</b> widget')
        icon = QIcon(os.getcwd() + "/img/fichier_icone_GS.gif")
        btn.setIconSize(QSize(50, 50))
        btn.setIcon(icon)
        btn.move(50, 50)
        btn.clicked.connect(self.close)

        self.setGeometry(self.insets.left(), self.insets.top(),
                         width - (self.insets.left() + self.insets.right()),
                         height - (self.insets.top() + self.insets.bottom()))
        self.setWindowTitle('Graphsound')
        self.setWindowIcon(QIcon(os.getcwd() + '/img/fichier_icone_GS.gif'))

        self.statusBar().showMessage('This is the status bar, we can show logs here')

        exitAction = QAction(QIcon('img/exit.png'), '&Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAction)

        file = open("conf/basicTheme.conf")
        self.styleConf = file.read()
        self.setStyleSheet(self.styleConf)

        self.center()
        self.showMaximized()
开发者ID:maxime-christ,项目名称:Graphsound,代码行数:36,代码来源:view.py

示例3: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        btn1 = QPushButton("Open Serial", self)
        btn1.clicked.connect(self.openSerial)
        btn1.resize(btn1.sizeHint())
        btn1.move(50, 50)

        btn2 = QPushButton("Close Serial", self)
        btn2.clicked.connect(self.closeSerial)
        btn2.resize(btn2.sizeHint())
        btn2.move(50, 100)

        exitAction = QAction(QIcon("exit.png"), "&Exit", self)
        exitAction.setShortcut("Alt+F4")
        exitAction.setStatusTip("Exit application")
        exitAction.triggered.connect(self.closeEvent)

        self.statusBar()
        menubar = self.menuBar()
        fileMenu = menubar.addMenu("&File")
        fileMenu.addAction(exitAction)

        self.statusBar().showMessage("Ready")
        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle("Motor Driver")

        self.show()
开发者ID:khrysro,项目名称:monocute,代码行数:28,代码来源:serial.py

示例4: initMenuBar

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initMenuBar(self):

        mainMenu = self.menuBar()

        fileMenu = mainMenu.addMenu('File')
        editMenu = mainMenu.addMenu('Edit')
        viewMenu = mainMenu.addMenu('View')

        exitButton = QAction(QIcon('exit24.png'), 'Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.setStatusTip('Exit application')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        searchButton = QAction('Search for URLs', self)
        searchButton.setShortcut('Ctrl+S')
        searchButton.setStatusTip('Looks for a URLS in a link or file.')
        searchButton.triggered.connect(self.on_view_searchword)
        fileMenu.addAction(searchButton)

        linkButton = QAction('Search File for Words', self)
        linkButton.setShortcut("Ctrl+F")
        linkButton.setShortcut("Find all words in File.")
        linkButton.triggered.connect(self.on_file_searchlink)
        fileMenu.addAction(linkButton)

        self.show()
开发者ID:defunSM,项目名称:wordcal,代码行数:29,代码来源:wordcalframe.py

示例5: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
	def initUI(self):
		# 状态栏
		self.statusBar().showMessage('Ready') # 状态栏是用来显示状态信息的组件

		# 创建一个抽象动作行为,用于菜单栏、工具栏或自定义快捷键
		exitAction = QAction(QIcon('exit.png'),'&Exit',self) # 设置图标、文本
		exitAction.setShortcut('Ctrl+Q') # 设置快捷键
		exitAction.setStatusTip('Exit application') # 在状态栏显示提示内容
		exitAction.triggered.connect(qApp.quit) # 选中后中断应用

		# 菜单栏
		menubar = self.menuBar() # 创建菜单栏
		fileMenu = menubar.addMenu('&File') # 创建File菜单
		fileMenu.addAction(exitAction) # 增加退出动作为菜单项

		# 工具栏
		self.toolbar = self.addToolBar('Exit') # 创建工具栏
		self.toolbar.addAction(exitAction) # 增加退出动作为工具项

		# 中心组件,文本框
		textEdit = QTextEdit() # 创建文本框
		self.setCentralWidget(textEdit) # 设置文本框为中心组件,自动占据所有剩下的空间

		# 其他设置
		self.setGeometry(300,300,500,400) # 位置、尺寸
		self.setWindowTitle('Menu Toolbar and Statusbar') # 标题
		self.show()
开发者ID:fiso0,项目名称:MxPython,代码行数:29,代码来源:menu_toolbar.py

示例6: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        textEdit = QTextEdit()
        self.setCentralWidget(textEdit)

        lbl1 = QLabel('PyQt5', self)
        lbl1.move(15,10)
        lbl2 = QLabel('tutorial',self)
        lbl2.move(35, 40)
        lbl3 = QLabel('for Programmers', self)
        lbl3.move(55, 70)

        exitAction = QAction(QIcon('20070420141711640.png'), '&Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(qApp.quit)

        self.exittoolbar = self.addToolBar('FileExit')
        self.exittoolbar.addAction(exitAction)
        self.editbar = self.addToolBar('Edit')
        # self.editbar.addAction(exitAction)

        self.statusBar().showMessage('Ready')
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAction)
        self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle('Menubar')
        self.show()
开发者ID:HappyJamesL,项目名称:pyqtlearn,代码行数:30,代码来源:menutoolbar.py

示例7: MainWindow

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
class MainWindow(QMainWindow):  
	def __init__(self,parent=None):  
		super(MainWindow,self).__init__(parent)  
		self.setWindowTitle(self.tr("打印图片"))  
       # 创建一个放置图像的QLabel对象imageLabel,并将该QLabel对象设置为中心窗体。 
		self.imageLabel=QLabel()  
		self.imageLabel.setSizePolicy(QSizePolicy.Ignored,QSizePolicy.Ignored)  
		self.setCentralWidget(self.imageLabel)  

		self.image=QImage()  
		  
       # 创建菜单,工具条等部件 
		self.createActions()  
		self.createMenus()  
		self.createToolBars()  

       # 在imageLabel对象中放置图像
		if self.image.load("./images/screen.png"):  
			self.imageLabel.setPixmap(QPixmap.fromImage(self.image))  
			self.resize(self.image.width(),self.image.height())  
									
	def createActions(self):  
		self.PrintAction=QAction(QIcon("./images/printer.png"),self.tr("打印"),self)  
		self.PrintAction.setShortcut("Ctrl+P")  
		self.PrintAction.setStatusTip(self.tr("打印"))  
		self.PrintAction.triggered.connect(self.slotPrint) 

	def createMenus(self):  
		PrintMenu=self.menuBar().addMenu(self.tr("打印"))  
		PrintMenu.addAction(self.PrintAction)  

	def createToolBars(self):  
		fileToolBar=self.addToolBar("Print")  
		fileToolBar.addAction(self.PrintAction)  

	def slotPrint(self):  
       # 新建一个QPrinter对象 
		printer=QPrinter()  
       # 创建一个QPrintDialog对象,参数为QPrinter对象 
		printDialog=QPrintDialog(printer,self)  

		'''
       判断打印对话框显示后用户是否单击“打印”按钮,若单击“打印”按钮,
       则相关打印属性可以通过创建QPrintDialog对象时使用的QPrinter对象获得,
       若用户单击“取消”按钮,则不执行后续的打印操作。 
		''' 		
		if printDialog.exec_():  
           # 创建一个QPainter对象,并指定绘图设备为一个QPrinter对象。
			painter=QPainter(printer)  
			# 获得QPainter对象的视口矩形
			rect=painter.viewport()  
			# 获得图像的大小
			size=self.image.size()  
			# 按照图形的比例大小重新设置视口矩形
			size.scale(rect.size(),Qt.KeepAspectRatio)  
			painter.setViewport(rect.x(),rect.y(),size.width(),size.height())  
			# 设置QPainter窗口大小为图像的大小
			painter.setWindow(self.image.rect()) 
			# 打印			
			painter.drawImage(0,0,self.image)  
开发者ID:kiorry,项目名称:PYQT,代码行数:62,代码来源:qt04_painter.py

示例8: add_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def add_action(
            self,
            icon_path,
            text,
            callback,
            enabled_flag=True,
            add_to_menu=True,
            add_to_toolbar=True,
            status_tip=None,
            whats_this=None,
            parent=None):
        """Add a toolbar icon to the toolbar."""

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(
                self.menu,
                action)

        self.actions.append(action)

        return action
开发者ID:mattkernow,项目名称:ZoomToPostcode-QGIS-Plugin,代码行数:37,代码来源:zoom_to_postcode.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def __init__(self, parent, editor):
        """ Object initialization.

        Parameters
        ----------
        self : QWidget
        parent : QWidget
        editor : QPlainTextEdit
            Widget containing the text to be edited with the toolbar.
        """
        super().__init__('Edit actions')
        self.editor = editor

        # ACTIONS

        # bold
        boldAction = QAction(QIcon('icons/format-text-bold'),
                'Bold', parent)
        boldAction.setStatusTip('Toggle bold format for the selection')
        boldAction.triggered.connect(lambda x: self.toggleTag("'''", "'''"))

        # italic
        italicAction = QAction(QIcon('icons/format-text-italic'),
                'Italic', parent)
        italicAction.setStatusTip('Toggle italic format for the selection')
        italicAction.triggered.connect(lambda x: self.toggleTag("''", "''"))

        # TOOLBAR

        self.addActions([
            boldAction,
            italicAction])
开发者ID:m-pilia,项目名称:wikied,代码行数:34,代码来源:EditToolbar.py

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def __init__(self):
        QWidget.__init__(self)
        self.cwd = None
        self.figure = Figure()
        self.canvas = FigureCanvas(self.figure)
        self.toolbar = NavigationToolbar(self.canvas, self)
        self.markers = None
        self.draggable = None
        self.img = None
        self.msize = 6

        openAction = QAction('&Open', self)        
        openAction.setShortcut('Ctrl+O')
        openAction.setStatusTip('Open folder')
        openAction.triggered.connect(self.open)
        
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(openAction)
        
        self.fileDrop = QComboBox()
        
        layout = QVBoxLayout()
        layout.addWidget(self.fileDrop)
        layout.addWidget(self.toolbar)
        layout.addWidget(self.canvas)
        
        window = QWidget()
        window.setLayout(layout);
        self.setCentralWidget(window)
        
        self.fileDrop.currentIndexChanged.connect(self.plot)
        
        self.show()
开发者ID:scholi,项目名称:pySPM,代码行数:36,代码来源:stability.py

示例11: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 10))
        self.setToolTip('This is a <b>QWidget</b> widget.')

        exitAction = QAction(QIcon('application-exit-4.png'), '&Exit', self)
        exitAction.setShortcut('Alt+F4')
        exitAction.setStatusTip('Exit Application')
        exitAction.triggered.connect(qApp.quit)
        menuBar = self.menuBar()
        fileMenu = menuBar.addMenu('&File')
        fileMenu.addAction(exitAction)
        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exitAction)

        grid = QGridLayout()
        lbl_1 = QLabel('1,1')
        lbl_2 = QLabel('1,2')
        lbl_3 = QLabel('2,1')
        lbl_4 = QLabel('2,2')
        grid.addWidget(lbl_1, 1, 1)
        grid.addWidget(lbl_2, 1, 2)
        grid.addWidget(lbl_3, 2, 1)
        grid.addWidget(lbl_4, 2, 2)

        mainW = QWidget()
        mainW.setLayout(grid)

        self.setCentralWidget(mainW)
        self.statusBar().showMessage('Ready')

        self.setGeometry(300, 300, 500, 500)
        self.setWindowTitle('Photos')
        self.setWindowIcon(QIcon('camera-photo-5.png'))
        self.center()
        self.show()
开发者ID:jean-petitclerc,项目名称:PhotosGUI,代码行数:37,代码来源:TestGUI.py

示例12: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        self.setWindowTitle("Children of the Goddess")

        # definisco l'azione ala chiusura
        exitAction = QAction(QIcon('exit.png'), 'Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        # creo la barra dei menu e aggiungo i menu
        menubar = self.menuBar()
        menubar.setNativeMenuBar(False)
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAction)

        # creo la toolbar
        toolbar = QToolBar()
        toolbar.addAction(exitAction)
        self.addToolBar(Qt.RightToolBarArea, toolbar)  # toolbar di default sul lato destro della finestra

        # cambio posizione e dimensioni della finestra e ne definisco il titiolo infine la faccio apparire
        self.resize(600, 400)
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
        self.setWindowTitle('Main window')
        self.show()
开发者ID:Thalos12,项目名称:game_core,代码行数:30,代码来源:main_menu_qt.py

示例13: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        self.setCentralWidget(QuizWidget(self))

        settings_action = QAction(QIcon(""), "Settings", self)
        settings_action.setShortcut("Ctrl+S")
        settings_action.setStatusTip("Settings")
        settings_action.triggered.connect(self.showSettingsDialog)
        # Load all the questions with all possible forms, tenses and polarities
        # so we have a question to ask at startup.
        settingsDialog = SettingsDialog()
        initial_quiz_data = settingsDialog.getQuizData()
        self.centralWidget().updateQuizData(initial_quiz_data)

        exit_action = QAction(QIcon(""), "Exit", self)
        exit_action.setShortcut("Ctrl+Q")
        exit_action.setStatusTip("Exit Application")
        exit_action.triggered.connect(qApp.exit)

        menu_bar = self.menuBar()
        menu_bar.setNativeMenuBar(False)
        file_menu = menu_bar.addMenu("&File")
        file_menu.addAction(settings_action)
        file_menu.addAction(exit_action)

        self.setGeometry(300, 300, 600, -1)
        self.setWindowTitle("Japanese Flash Cards")
        self.show()
开发者ID:Braz3n,项目名称:JapaneseConjugationFlashCards,代码行数:29,代码来源:gui.py

示例14: layercontextmenu

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
def layercontextmenu(layer, pos, parent=None):
    """Show a context menu to manipulate properties of layer.

    layer -- a volumina layer instance
    pos -- QPoint

    """
    menu = QMenu("Menu", parent)

    # Title
    title = QAction("%s" % layer.name, menu)
    title.setEnabled(False)
    menu.addAction(title)

    # Export
    global _has_lazyflow
    if _has_lazyflow:
        export = QAction("Export...", menu)
        export.setStatusTip("Export Layer...")
        export.triggered.connect(partial(prompt_export_settings_and_export_layer, layer, menu))
        menu.addAction(export)

    menu.addSeparator()
    _add_actions(layer, menu)

    # Layer-custom context menu items
    menu.addSeparator()
    for item in layer.contexts:
        if isinstance(item, QAction):
            menu.addAction(item)
        elif isinstance(item, QMenu):
            menu.addMenu(item)

    menu.exec_(pos)
开发者ID:ilastik,项目名称:volumina,代码行数:36,代码来源:layercontextmenu.py

示例15: initUI

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setStatusTip [as 别名]
    def initUI(self):
        # definisco le azioni
        exitAction = QAction(QIcon('exit.png'), 'Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        # creo la barra dei menu e aggiungo i menu
        menubar = self.menuBar()
        menubar.setNativeMenuBar(False)
        fileMenu = menubar.addMenu('&File')
        fileMenu.addAction(exitAction)

        # creo la toolbar
        toolbar = QToolBar()
        toolbar.addAction(exitAction)
        self.addToolBar(Qt.RightToolBarArea, toolbar)  # toolbar di default sul lato destro della finestra

        # aggiungo il widget centrale
        self.setCentralWidget(LoginWindow(self))

        # cambio posizione e dimensioni della finestra e ne definisco il titiolo infine la faccio apparire
        self.resize(600, 400)
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
        self.setWindowTitle('Main window')
        self.show()

        # imposto la statusbar per scrivere che l'app è pronta
        self.statusBar().showMessage('Ready')
开发者ID:Thalos12,项目名称:game_core,代码行数:34,代码来源:prova_qt.py


注:本文中的PyQt5.QtWidgets.QAction.setStatusTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。