Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rendercanvas/_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .utils import asyncadapter

if TYPE_CHECKING:
from typing import Any, Callable, Coroutine, List
from typing import Any, Callable, Coroutine
from base import BaseRenderCanvas

CallbackFunction = Callable[[], Any]
Expand Down Expand Up @@ -83,7 +83,7 @@ def _unregister_canvas_group(self, canvas_group):
# A CanvasGroup will call this when it selects a different loop.
self.__canvas_groups.discard(canvas_group)

def get_canvases(self) -> List[BaseRenderCanvas]:
def get_canvases(self) -> list[BaseRenderCanvas]:
"""Get a list of currently active (not-closed) canvases."""
canvases = []
for canvas_group in self.__canvas_groups:
Expand Down
14 changes: 7 additions & 7 deletions rendercanvas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ._coreutils import logger, log_exception

if TYPE_CHECKING:
from typing import Callable, List, Literal, Optional, Tuple
from typing import Callable, Literal, Optional

EventHandlerFunction = Callable[[dict], None]
DrawFunction = Callable[[], None]
Expand Down Expand Up @@ -74,7 +74,7 @@ def get_loop(self) -> BaseLoop | None:
"""Get the currently associated loop (can be None for canvases that don't run a scheduler)."""
return self._loop

def get_canvases(self) -> List[BaseRenderCanvas]:
def get_canvases(self) -> list[BaseRenderCanvas]:
"""Get a list of currently active (not-closed) canvases for this group."""
return [canvas for canvas in self._canvases if not canvas.get_closed()]

Expand Down Expand Up @@ -123,7 +123,7 @@ def select_loop(cls, loop: BaseLoop) -> None:
def __init__(
self,
*args,
size: Tuple[float, float] | None = (640, 480),
size: tuple[float, float] | None = (640, 480),
title: str | None = "$backend",
update_mode: UpdateModeEnum = "ondemand",
min_fps: float = 0.0,
Expand Down Expand Up @@ -221,7 +221,7 @@ def __del__(self):

_canvas_context = None # set in get_context()

def get_physical_size(self) -> Tuple[int, int]:
def get_physical_size(self) -> tuple[int, int]:
"""Get the physical size of the canvas in integer pixels."""
return self.__size_info["physical_size"]

Expand Down Expand Up @@ -566,7 +566,7 @@ def _draw_frame_and_present(self):

# %% Primary canvas management methods

def get_logical_size(self) -> Tuple[float, float]:
def get_logical_size(self) -> tuple[float, float]:
"""Get the logical size (width, height) of the canvas in float pixels.

The logical size can be smaller than the physical size, e.g. on HiDPI
Expand Down Expand Up @@ -802,10 +802,10 @@ def request_draw(self, draw_function: Optional[DrawFunction] = None) -> None:
def force_draw(self) -> None:
self._subwidget.force_draw()

def get_physical_size(self) -> Tuple[int, int]:
def get_physical_size(self) -> tuple[int, int]:
return self._subwidget.get_physical_size()

def get_logical_size(self) -> Tuple[float, float]:
def get_logical_size(self) -> tuple[float, float]:
return self._subwidget.get_logical_size()

def get_pixel_ratio(self) -> float:
Expand Down