Skip to content

[ Enhancement ] Mouseover images for Buttons #6892

Description

@PySimpleGUI

Type of Issue (Enhancement, Error, Bug, Question)

Enhancement


Operating System

Win, Mac, Linux

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

PySimpleGUI Version (sg.__version__)

6.2.1

Detailed Description

I stumbled onto the Iconipy project and a couple of others that featured mouseover images. It sounded like an interesting feature to add to PySimpleGUI. It's been possible for a long time for users to do this on their own, but it's not the cleanest code since the user's event loop needs to handle the mouseovers. So, I'm trying out what it's like to do it via the Button element itself.

Test Harness

import PySimpleGUI as sg

"""
    Demo - Mouseover Images

    Demo of mouseover images on Buttons.  Can specify a mouseover image if an image is set for a Button

    Copyright 2026 PySimpleGUI. All rights reserved.
"""

def main():
    layout = [[sg.Button(image_source=sg.EMOJI_BASE64_HAPPY_BIG_SMILE, mouseover_image_source=sg.EMOJI_BASE64_SAD, k='-BUTTON 1-'),
               sg.Button(image_source=sg.EMOJI_BASE64_HAPPY_LAUGH, mouseover_image_source=sg.EMOJI_BASE64_CRY, k='-BUTTON 2-')]]

    window = sg.Window('Mouseover Image Test', layout)
    while True:
        event, values = window.read()
        print(event, values)
        if event == sg.WIN_CLOSED or event == 'Exit':
            break
    window.close()


if __name__ == '__main__':
    main()

Screenshot

python_6EggpLak7M.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions