Changed code to support older Python versions
This commit is contained in:
parent
eb92d2d36f
commit
582458cdd0
5027 changed files with 794942 additions and 4 deletions
29
venv/lib/python3.11/site-packages/rich_toolkit/button.py
Normal file
29
venv/lib/python3.11/site-packages/rich_toolkit/button.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any, Callable, Optional
|
||||
|
||||
from .element import Element
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .styles.base import BaseStyle
|
||||
|
||||
|
||||
class Button(Element):
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
label: str,
|
||||
callback: Optional[Callable] = None,
|
||||
style: Optional[BaseStyle] = None,
|
||||
**metadata: Any,
|
||||
):
|
||||
self.name = name
|
||||
self.label = label
|
||||
self.callback = callback
|
||||
|
||||
super().__init__(style=style, metadata=metadata)
|
||||
|
||||
def activate(self) -> Any:
|
||||
if self.callback:
|
||||
return self.callback()
|
||||
return True
|
||||
Loading…
Add table
Add a link
Reference in a new issue