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


Python QtWidgets.QToolTip类代码示例

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


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

示例1: __init__

 def __init__(self, title):
     super().__init__()
     self.setWindowTitle(title)
     QToolTip.setFont(QFont('SansSerif', 10))
     self.setGeometry(400, 400, 300, 200)
     self.build_buttons()
     self.show()
开发者ID:chriswood,项目名称:photoapp,代码行数:7,代码来源:main.py

示例2: mouseMoveEvent

 def mouseMoveEvent(self, event):
     super().mouseMoveEvent(event)
     # tooltip_position = event.globalPos() - QPoint(event.pos().x(), 0)
     from_line = self._neditor.first_visible_block().blockNumber() + 1
     to_line = self._neditor.last_visible_block().blockNumber()
     text = "<center>%d<br/>&#x2014;<br/>%d</center>"
     QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:7,代码来源:scrollbar.py

示例3: initUI

    def initUI(self):
        """On definit une methode pour definir la fenetre graphique"""

        #On definit la police et la taille du texte dans les bulles d'aide
        QToolTip.setFont(QFont('SansSerif', 10))
        #On definit le texte a afficher lors du passage sur la fenetre
        self.setToolTip("Exemple de creation d'une <b>bulle</b> d'aide pour la fenetre")
        #Creation d'un bouton
        btn = QPushButton('Bouton', self)
        #On met en place une bulle d'aide
        btn.setToolTip("Voici un bouton inutile !")
        #On redefinit la taille sur le texte, ici on applique une taille recommandée
        btn.resize(btn.sizeHint())
        btn.move(50, 50)

        #Creation du bouton pour quitter la fenetre
        qbtn = QPushButton('Quit', self)
        #On connecte une action au clique
        qbtn.clicked.connect(QCoreApplication.instance().quit)
        #On met en place une bulle d'aide
        btn.setToolTip("Ce bouton sert à quitter la fenetre !")
        qbtn.resize(qbtn.sizeHint())
        #Positionnement du bouton
        qbtn.move(150, 150)

        #Definition des attributs de la fenetre
        self.setGeometry(300, 300, 300, 220)
        self.setWindowTitle('PC2')
        self.setWindowIcon(QIcon('PC2.png'))
开发者ID:ProjetPC2,项目名称:SIMM-2.0,代码行数:29,代码来源:PremiereFenetre.py

示例4: initUI

    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,代码行数:35,代码来源:TestGUI.py

示例5: gui_choise_server_client

    def gui_choise_server_client(self):
        self.hide_last_objects()

        QToolTip.setFont(QFont('SansSerif', 10))

        btn_server = QPushButton('Server', self)
        btn_server.clicked.connect(self.server_set_socket_settings_gui) # from server.ServerMixin TODO аналогично
        btn_server.resize(btn_server.sizeHint())
        btn_server.move(50, 50)


        btn_client = QPushButton('Client', self)
        btn_client.clicked.connect(self.client_set_socket_settings_gui) # from client.ClientMixin
        btn_client.resize(btn_client.sizeHint())
        btn_client.move(150, 50)

        btn_exit = QPushButton('Quit', self)
        btn_exit.clicked.connect(QCoreApplication.instance().quit)
        btn_exit.resize(btn_exit.sizeHint())
        btn_exit.move(200, 170)

        self.setGeometry(450, 300, 300, 200)
        self.setWindowTitle('Client_Server')
        self.show()

        self.objects_to_hide = (btn_exit, btn_client, btn_server)
        self.show_current_objects()
开发者ID:Nick1994209,项目名称:security_communication_with_DiffieHellman,代码行数:27,代码来源:main.py

示例6: mouseMoveEvent

    def mouseMoveEvent(self, event):
        position = self.mapFromGlobal(event.globalPos())
        key = (position.y() // self.cellSize) * self.columns + position.x() // self.cellSize

        text = '<p>Character: <span style="font-size: 24pt; font-family: %s">%s</span><p>code: %d' % (
                self.displayFont.family(), self._chr(key), key+32)
        QToolTip.showText(event.globalPos(), text, self)
开发者ID:LeftRadio,项目名称:ngl_utils,代码行数:7,代码来源:editwidget.py

示例7: moved

 def moved(self, pos):
     with self.lock:
         fee_rate = self.config.dynfee(pos) if self.dyn else self.config.static_fee(pos)
         tooltip = self.get_tooltip(pos, fee_rate)
         QToolTip.showText(QCursor.pos(), tooltip, self)
         self.setToolTip(tooltip)
         self.callback(self.dyn, pos, fee_rate)
开发者ID:JustinTArthur,项目名称:electrum,代码行数:7,代码来源:fee_slider.py

示例8: verifier_feuille

 def verifier_feuille(self, eq1, eq2):
     print(eq1, eq2)
     for nom, eq in (('d1', eq1), ('d2', eq2)):
         if nom in self.feuille_actuelle.objets.noms:
             d = self.feuille_actuelle.objets[nom]
             d.label(mode='nom')
             champ = self.feuille_actuelle.objets['champcache_' + nom]
             M, N = d
             M = (int(M.x), int(M.y))
             N = (int(N.x), int(N.y))
             if self.eq_reduite(M, N) == eq:
                 d.style(couleur='g')
                 champ.texte = 'ok'
                 msg = 'La droite %s est correcte.' % nom
                 if nom == 'd1':
                     msg += ' Construisez maintenant d2.'
             else:
                 print(self.eq_reduite(*d), eq)
                 d.style(couleur='r')
                 # On peut mettre n'importe quoi différent de ok dans
                 # champ, l'idée étant que si la droite est fausse mais
                 # n'a pas changé, on ne perde pas de point, et par
                 # contre on perde des points en cas de changement si
                 # c'est toujours faux.
                 champ.texte = str(d.equation)
                 msg = "Attention, la droite %s est fausse." % nom
             QToolTip.showText(QCursor.pos(), msg)
             self.canvas.message(msg, temporaire=False)
开发者ID:wxgeo,项目名称:geophar,代码行数:28,代码来源:__init__.py

示例9: mouseMoveEvent

 def mouseMoveEvent(self, event):
     cursor = self._neditor.cursorForPosition(event.pos())
     line = cursor.blockNumber()
     bookmarks = self._bookmark_manager.bookmarks(self._neditor.file_path)
     for book in bookmarks:
         if book.lineno == line and book.note:
             QToolTip.showText(self.mapToGlobal(event.pos()), book.note)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:7,代码来源:marker_widget.py

示例10: event

 def event(self, ev):
     if ev.type() == QEvent.ToolTip:
         if self._showToolTips:
             c = self.charcodeAt(ev.pos())
             if c:
                 text = self.getToolTipText(c)
                 if text:
                     rect = self.charcodeRect(c)
                     QToolTip.showText(ev.globalPos(), text, self, rect)
                     ev.accept()
                     return True
     elif ev.type() == QEvent.QueryWhatsThis:
         if self._showWhatsThis:
             ev.accept()
             return True
     elif ev.type() == QEvent.WhatsThis:
         ev.accept()
         if self._showWhatsThis:
             c = self.charcodeAt(ev.pos())
             text = self.getWhatsThisText(c) if c else None
             if text:
                 QWhatsThis.showText(ev.globalPos(), text, self)
             else:
                 QWhatsThis.leaveWhatsThisMode()
         return True
     return super(CharMap, self).event(ev)
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:26,代码来源:charmap.py

示例11: initUI

    def initUI(self):

        QToolTip.setFont(QFont('SansSerif', 10))

        btNewChecklist = QPushButton('Criar', self)
        btNewChecklist.clicked.connect(self.salvarChecklist)

        nomeLabel = QLabel('Nome')

        self._nome = QLineEdit()

        grid = QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(nomeLabel, 1, 0)
        grid.addWidget(self._nome, 1, 1)

        grid.addWidget(btNewChecklist, 3, 1)

        self.setLayout(grid)

        self.setGeometry(300, 300, 350, 300)
        self.center()
        self.setWindowTitle('CheckList')
        self.show()
开发者ID:felipe-melo,项目名称:ProjetoCheckList,代码行数:25,代码来源:NovaPergunta.py

示例12: __init__

    def __init__(self,parent=None):
        QWidget.__init__(self, parent)

        self.setGeometry(300,300,250,150)
        self.setWindowTitle('Tooltip')
        self.setToolTip('This is a <b> QWidget </b>widget')
        QToolTip.setFont(QFont('oldEnglish',10))
开发者ID:yafeile,项目名称:Simple_Study,代码行数:7,代码来源:ToolTip_1.py

示例13: execute_queries

    def execute_queries(self, query=''):
        """ This function executes queries """

        # Hide tooltip if visible
        if QToolTip.isVisible():
            QToolTip.hideText()

        # If text is selected, then this text is the query,
        # otherwise the query is all text that has the editor
        editor_widget = self.currentWidget().get_editor()
        if editor_widget.textCursor().hasSelection():
            query = editor_widget.textCursor().selectedText()
        else:
            query = editor_widget.toPlainText()

        relations = self.currentWidget().relations
        central = Pireal.get_service("central")
        table_widget = central.get_active_db().table_widget

        # Restore
        relations.clear()
        self.currentWidget().clear_results()

        # Parse query
        sc = scanner.Scanner(query)
        lex = lexer.Lexer(sc)
        try:
            par = parser.Parser(lex)
            interpreter = parser.Interpreter(par)
            interpreter.clear()
            interpreter.to_python()
        except Exception as reason:
            pireal = Pireal.get_service("pireal")
            pireal.show_error_message(self.parse_error(reason.__str__()))
            return
        relations.update(table_widget.relations)
        for relation_name, expression in list(interpreter.SCOPE.items()):
            if relation_name in relations:
                QMessageBox.critical(self,
                                     self.tr("Query Error"),
                                     self.tr("<b>{}</b> is a duplicate "
                                             "relation name.<br><br> "
                                             "Please choose a unique name "
                                             "and re-execute the "
                                             "queries.".format(
                                                 relation_name)))
                del interpreter.SCOPE[relation_name]
                return
            try:
                new_relation = eval(expression, {}, relations)

            except Exception as reason:
                pireal = Pireal.get_service("pireal")
                pireal.show_error_message(self.parse_error(reason.__str__()),
                                          syntax_error=False)
                return

            relations[relation_name] = new_relation
            self.__add_table(new_relation, relation_name)
开发者ID:centaurialpha,项目名称:pireal,代码行数:59,代码来源:query_container.py

示例14: mousePressEvent

 def mousePressEvent(self, event):
     super().mousePressEvent(event)
     if event.button() == Qt.LeftButton:
         self._tooltip_pos = event.globalPos() - QPoint(event.pos().x(), 0)
         from_line = self._neditor.first_visible_block().blockNumber() + 1
         to_line = self._neditor.last_visible_block().blockNumber()
         text = "<center>%d<br/>&#x2014;<br/>%d</center>"
         QToolTip.showText(self._tooltip_pos, text % (from_line, to_line))
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:8,代码来源:scrollbar.py

示例15: initUI

    def initUI(self):
        QToolTip.setFont(QFont('SansSerif', 10))
        self.setToolTip('This is a <b>QWidget</b> widget.')
        #quitBtn = QPushButton('Quit', self)
        #quitBtn.clicked.connect(self.quitBtnEvent())
        #quitBtn.clicked.connect(QCoreApplication.instance().quit)
        #quitBtn.setToolTip('This is a <b>QPushButton</b> widget.')
        #quitBtn.resize(quitBtn.sizeHint())

        exitAction = QAction(QIcon('application-exit-4.png'), '&Exit', self)
        exitAction.setShortcut('Alt+F4')
        exitAction.setStatusTip('Exit Application')
        exitAction.triggered.connect(qApp.quit)

        menuBar = QMenuBar()
        fileMenu = menuBar.addMenu('&File')
        fileMenu.addAction(exitAction)
        fileMenu.resize(fileMenu.sizeHint())

        toolBar = QToolBar(self)
        toolBar.addAction(exitAction)
        #toolBar.resize(toolBar.sizeHint())
        toolBar.setFixedHeight(60)

        hozLine = QFrame()
        hozLine.setFrameStyle(QFrame.HLine)
        #hozLine.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Expanding)

        statusBar = QStatusBar(self)
        statusBar.showMessage('Ready')

        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)

        vbox = QVBoxLayout()
        vbox.addWidget(menuBar)
        vbox.addWidget(hozLine)
        vbox.addWidget(toolBar)
        # vbox.addWidget(hozLine)
        vbox.addLayout(grid)
        vbox.addStretch(1)
        vbox.addWidget(statusBar)

        self.setLayout(vbox)

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


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