Change Image on a Window when mouse is hover

With Maya Python and not QT, is there any way that we can change an image(not icon) on a window when the mouse is hovering on top of this image?
So basically if we have an image A with specific path, when the mouse is hovering on top of this, the path of this image will change to another one, let’s say image B.

Yep totally possible.
What have you tried that’s not working?
Did you enable mouse tracking?

Well i am not using Qwidgets and i was wondering if this is possible without them.
The only thing i have managed to do, concerning changing the path of an image is via a button but not with hovering the mouse.

Oh sorry, I missed the “NOT” in front of qt. That’s my bad.
What are you using then? Maya cmds? Something else?

Just maya python commands

Sorry, I started answering thinking it was a qt question. I’m no expert on maya cmds UI’s.

However, a second set of eyes can’t hurt.
Looking at the docs for all the UI related commands, I can’t find anything that would come close to allowing this. It would have to be some kind of callback, and the only ones I can find all react to some mouse button press.

Best guess is that you can’t do this.

I see.
Thank you by the way.
So i will have to try with mouse button press i guess.
And that will be achieved by using a callback?
Sorry for my questions i am not expert and i am trying to understand how this is going to work.

A callback in UI’s is a generic term for a function that gets run when an event happens. So like when you create a button in cmds with the command= option, or the dragCallback= option. The things you pass to those options are your callbacks.
So if you want to change the image when a button is pressed, you write a function that changes the image, and pass that function as the argument to the command= option when you create the button. That function is now being used as a callback for when the button is clicked.

Great thank you.
I did a test and its working and the image is changing with the press of a button.
But still the image itself is not a button and if i am not wrong without qt i cant make an image a button.