diff --git a/webview/menu.py b/webview/menu.py index 5a07169d..b010bdf5 100644 --- a/webview/menu.py +++ b/webview/menu.py @@ -1,10 +1,11 @@ from __future__ import annotations from collections.abc import Callable +from typing import Any, Union class Menu: - def __init__(self, title: str, items: list[str] = []) -> None: + def __init__(self, title: str, items: list[Union[Menu, MenuAction, MenuSeparator]] = []) -> None: """ Args: title: the menu or submenu title @@ -15,7 +16,7 @@ def __init__(self, title: str, items: list[str] = []) -> None: class MenuAction: - def __init__(self, title: str, function: Callable[[], None]) -> None: + def __init__(self, title: str, function: Callable[[], Any]) -> None: self.title = title self.function = function # TODO: support platform-agnostic shortcut