PyQt5 – Magnify combobox when mouse is on it
In this article we will see how we can magnify the combo box when mouse is on it. Magnify means enlarging the size of the combo box when cursor is on it. We can’t change the size of combo box using style sheet therefore we can not use hover in stylesheet. In to know when mouse is on combo box we use
In order to do this we use
Syntax : combo_box.underMouse()
Argument : It takes no argument
Return : It returns bool
Steps for implementation :
1. Create a combo box.
2. Create a timer object which calls a function after every 100 milliseconds.
3. Inside the timer function check if the combo box is under mouse.
4. If combo box is under the mouse increase its size else make its size smaller.
Below is the implementation –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course