'Is there a way to visually hold a button after it's been pressed in PySimleGUI?

I want to replace a dropdown with the user clicking an option instead.

I currently have this:

enter image description here

I need this instead: enter image description here

Here's my code (contains pseudocode because I don't know how "deselecting" would work either:

import PySimpleGUI as sg

layout = [

    [ sg.Text("Testing") ],
    [sg.Input(key="in")],

    [ sg.Text ("Language?"), sg.Button("German", key="ger"), sg.Button("French", key="fr")],
]
window = sg.Window("This is for testing purposes", layout)

while True:

    event, values = window.read()

    if event == sg.WINDOW_CLOSED:
        break
    
    if event == "ger":
        deselect("fr") if "fr" is selected
        option = "german"
        ...
    
    if event  == "fr":
        deslect("ger") if "ger" is selected
        option = "french"
        ...

In short, I want to switch from dropdown selection to buttons that show the user that they're currently selecting button X as their option, and if they select another button (button Y), then it would unselect button X and show that button Y is now selected instead.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source