Skip to main content

pyqt-tooltip-widget

PyQt QWidget as a tooltip

Requirements

  • PyQt5 >= 5.8

Setup

python -m pip install pyqt-tooltip-widget

Detailed Description

This is QWidget which is activated like tooltip. When mouse cursor enters to the widget, ToolTipWidget pops up at the bottom left of the widget. Leave from the widget tooltip will be disappeared.

I made it work by catching QEnterEvent and QLeaveEvent of widget.

ToolTipWidget inherits QWidget, so you can decorate it just like QWidget.

Usage

Just make instance of it like self.toolTip = ToolTipWidget(yourWidget). yourWidget argument is the widget which you want to set tooltip of. Instance should be class variable.

Method Overview

  • setStillOpenWhenCursorLeaveFromToolTipWidget(f: bool) - Tooltip will be kept showing when cursor is inside the tooltip. (this is disabled by default)

  • isStillOpenWhenCursorLeaveFromToolTipWidget() -> bool

Example

Code Sample

from PyQt5.QtWidgets import QWidget, QMainWindow, QHBoxLayout, QPushButton, QApplication, QVBoxLayout

from pyqt_date_table_widget import DateTableWidget

from pyqt_tooltip_widget import ToolTipWidget





class MainWindow(QMainWindow):

    def __init__(self):

        super().__init__()

        self.__initUi()



    def __initUi(self):

        btn = QPushButton('Show Date Table Widget')

        lay = QHBoxLayout()

        lay.addWidget(btn)



        mainWidget = QWidget()

        mainWidget.setLayout(lay)



        ### Make tooltip start ###

        dateTableWidget = DateTableWidget() # https://github.com/yjg30737/pyqt-date-table-widget.git

        lay = QVBoxLayout()

        lay.addWidget(dateTableWidget)

        lay.setContentsMargins(0, 0, 0, 0)



        self.__tooltip = ToolTipWidget(btn)

        self.__tooltip.setFixedSize(200, 200)

        self.__tooltip.setLayout(lay)

        ### Make tooltip end ###



        self.setCentralWidget(mainWidget)





if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    example = MainWindow()

    example.show()

    app.exec_()

Result

image

Metadata

Release files for pyqt-tooltip-widget 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyqt-tooltip-widget 0.0.1
File Size Uploaded
pyqt-tooltip-widget-0.0.1.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyqt-tooltip-widget 0.0.1
File Interpreter ABI Platform
pyqt_tooltip_widget-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / pyqt-tooltip-widget-0.0.1.tar.gz

Download URL pyqt-tooltip-widget-0.0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7f5dad1d14e41bc644b048026cd4b5e84df184c60ecb64d9da6828e655464765
BLAKE2b-256 checksum
How to use checksums
40101989f8482acddcd06c238f7794d4d0d131c5c9c6ea476c280aefd05b7a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release files / pyqt_tooltip_widget-0.0.1-py3-none-any.whl

Download URL pyqt_tooltip_widget-0.0.1-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a554b8201f51dc9c3e2cc79785e3d961336db4cc21c5114f14d20fd19c473b4
BLAKE2b-256 checksum
How to use checksums
09cdc6f4df3c6d69042c969fdae6d3300faefee4dfb5490ff42ec80c6bbd6db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/0.0.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page