PyQt5 Scrollable Label – Setting tool tip duration
In this article we will see how we can set tooltip duration to the scroll-able label. By default when we create a label all the text is in the single line and if length of text is greater than label, extra text didn’t show, although with the help of
setWordWrap method we can create a multi-line label but still if the text exceeds it will not show in the label. In order to show whole text in a small label we have to make label scroll-able, in order to do this we have to make our own scrollable label class which inherits the QScrollArea class which allows to us to make label scroll-able.
Steps for implementations –
1. Create a new class which inherits QScrollArea
2. Inside the class create vertical layout
3. Create a label and make it multi-line and add it to the layout
5. Over-ride the setText and text method for label
6. Creat object of this class inside the main window class and setting text to it
7. Add tooltip to the object with the help of
8. Add tooltip duration to the object with the help of
Below is the implementation
This tooltip will disappear after 1 second.