Closed Adoniyas7 closed 6 months ago
i've been looking for this feature. its so important it should be added
It's better if you add a video on how to add the button hover effect.
Thank you for the suggestion! I appreciate your feedback. I will definitely add a video tutorial on how to add the button hover effect to make it easier for everyone to follow along.
It's better if you add a video on how to add the button hover effect.
I have created a simple and short video tutorial on how to add button hover effect. You can check it out with this link: https://watch.screencastify.com/v/saDGrNayjwSmxbFbShB1
Let me know if you have any questions!
You can add
#### Refer to [this video](https://watch.screencastify.com/v/saDGrNayjwSmxbFbShB1) if you face any problem
under
9. **Button with Hover Effect**
- Duplicate the Button you created in the previous step
- You can duplicate the Button by selecting the button group and pressing <kbd>CTRL/⌘ + D</kbd>
- Rename the duplicate button to "ButtonHover"
- Place the duplicate button above the original button
- Make sure it's on the same position as the original button
- x and y coordinates should be the same
- Make changes to the duplicate button for the hover effect
- For example, change the color
You can add
#### Refer to [this video](https://watch.screencastify.com/v/saDGrNayjwSmxbFbShB1) if you face any problem
under9. **Button with Hover Effect** - Duplicate the Button you created in the previous step - You can duplicate the Button by selecting the button group and pressing <kbd>CTRL/⌘ + D</kbd> - Rename the duplicate button to "ButtonHover" - Place the duplicate button above the original button - Make sure it's on the same position as the original button - x and y coordinates should be the same - Make changes to the duplicate button for the hover effect - For example, change the color
Thank you! I have added it to the README.
Hey @Adoniyas7 , That's very good work! Thank you for working on this feature. Although i'm not sure about the complexity it adds to the process.
Can you add EXPERIMENTAL
Labels to the mentions of Button_Hover
so it becomes clear that it's an early feature.
Hey @Adoniyas7 , That's very good work! Thank you for working on this feature. Although i'm not sure about the complexity it adds to the process.
Can you add
EXPERIMENTAL
Labels to the mentions ofButton_Hover
so it becomes clear that it's an early feature.
Hi @ParthJadhav ,
Thank you for your feedback! I'm glad you like the work I've done on the Button_Hover
feature. I understand your concern about the complexity it adds to the process. I've added EXPERIMENTAL
labels to the mentions of Button_Hover
so it becomes clear that it's an early feature.
I'm happy to answer any questions you have about the feature or the code. I'm also open to suggestions for how to improve it.
Thank you again for your feedback!
To the people who have write access, can anybody merge this to ParthJadhav:master
Hey @Adoniyas7 , That's very good work! Thank you for working on this feature. Although i'm not sure about the complexity it adds to the process. Can you add
EXPERIMENTAL
Labels to the mentions ofButton_Hover
so it becomes clear that it's an early feature.Hi @ParthJadhav ,
Thank you for your feedback! I'm glad you like the work I've done on the
Button_Hover
feature. I understand your concern about the complexity it adds to the process. I've addedEXPERIMENTAL
labels to the mentions ofButton_Hover
so it becomes clear that it's an early feature.I'm happy to answer any questions you have about the feature or the code. I'm also open to suggestions for how to improve it.
Thank you again for your feedback!
Radio button with the same effect??
Just by
@ParthJadhav You should probably think about merging this PR.
Thanks for the changes @Adoniyas7 !
I am submitting this pull request to propose a new feature for Tkinter-Designer, which is a Button Hover effect. The way it works is very simple. I have added a new element named
ButtonHover
and a class with the same name to convert the the element into a button with a hover effect.How does the code work
The main class that generates the code for the hover effect is called
ButtonHover
. TheButtonHover
class is designed to generate code for creating a hover effect on a button. It takes in three parameters: a node, a frame, and an image_path. The node and frame parameters specify the position of the button on the canvas, while the image_path parameter specifies the path to the image that will be displayed when the button is hovered over.To create the hover effect, the
ButtonHover
class needs to know the id of the original button element that it is associated with. This is because the hover effect code needs to be bound to the original button's events. To get the id, theButtonHover
class checks whether the (x, y) position of the button is present in apsition_id_map
dictionary. Thepsition_id_map
dictionary maps the position of each button on the canvas to a unique id.If the (x, y) position of the button is present in the
psition_id_map
, theButtonHover
class generates the code required to create the hover effect. The code first creates a PhotoImage object using the imagepath parameter. Then, it defines two functions: `button{id}hoverand
button{id}_leave. The
{id}in the function names is the id of the original button that the
ButtonHover` class is associated with.The event of the original button. This event is triggered when the mouse cursor enters the button's area. When the event is triggered, the function changes the image of the original button to the image specified by the
button_{id}_hover
function is bound to theButtonHover
class.The event of the original button. This event is triggered when the mouse cursor leaves the button's area. When the event is triggered, the function changes the image of the original button back to its original image.
button_{id}_leave
function is bound to theFinally, the
ButtonHover
class returns the generated code as a string. This code can then be used to create the hover effect on the original button.How to create a button hover effect
I have added this instructions on the instructions.md file. I hope you find it useful. Thank you for considering my pull request.
Here is a video tutorial
https://watch.screencastify.com/v/saDGrNayjwSmxbFbShB1
316