Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManagerRadio unchecked all #344

Open
Loclhost opened this issue Dec 13, 2023 · 1 comment
Open

ManagerRadio unchecked all #344

Loclhost opened this issue Dec 13, 2023 · 1 comment
Labels
bug Something isn't working widget New widget request, or some widget fixes

Comments

@Loclhost
Copy link

I can't set ManagedRadio's state when none of the buttons are active, passing None to the set_checked method doesn't work

@Tishka17 Tishka17 added bug Something isn't working widget New widget request, or some widget fixes labels Dec 26, 2023
@lubaskinc0de
Copy link
Contributor

but it working on latest develop

async def get_data(**_kwargs):
    fruits = [
        ("Apple", '1'),
        ("Pear", '2'),
        ("Orange", '3'),
        ("Banana", '4'),
    ]
    return {
        "fruits": fruits,
        "count": len(fruits),
    }


fruits_kbd = Radio(
    Format("🔘 {item[0]}"),  # E.g `🔘 Apple`
    Format("⚪️ {item[0]}"),
    id="r_fruits",
    item_id_getter=operator.itemgetter(1),
    items="fruits",
)


async def remove_selection(call: CallbackQuery, _widget, manager: DialogManager):
    widget: ManagedRadio = manager.find("r_fruits")
    await widget.set_checked(None)
    await call.answer()


main_window = Window(
    "Radio!",
    fruits_kbd,
    Button(Const("Radio!"), id="remove_selection", on_click=remove_selection),
    state=MySG.main,
    getter=get_data,
)

when i press button all buttons in radio stop being active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working widget New widget request, or some widget fixes
Projects
None yet
Development

No branches or pull requests

3 participants