|
21 | 21 | from ._coreutils import logger, log_exception |
22 | 22 |
|
23 | 23 | if TYPE_CHECKING: |
24 | | - from typing import Callable, List, Literal, Optional, Tuple |
| 24 | + from typing import Callable, Literal, Optional |
25 | 25 |
|
26 | 26 | EventHandlerFunction = Callable[[dict], None] |
27 | 27 | DrawFunction = Callable[[], None] |
@@ -74,7 +74,7 @@ def get_loop(self) -> BaseLoop | None: |
74 | 74 | """Get the currently associated loop (can be None for canvases that don't run a scheduler).""" |
75 | 75 | return self._loop |
76 | 76 |
|
77 | | - def get_canvases(self) -> List[BaseRenderCanvas]: |
| 77 | + def get_canvases(self) -> list[BaseRenderCanvas]: |
78 | 78 | """Get a list of currently active (not-closed) canvases for this group.""" |
79 | 79 | return [canvas for canvas in self._canvases if not canvas.get_closed()] |
80 | 80 |
|
@@ -123,7 +123,7 @@ def select_loop(cls, loop: BaseLoop) -> None: |
123 | 123 | def __init__( |
124 | 124 | self, |
125 | 125 | *args, |
126 | | - size: Tuple[float, float] | None = (640, 480), |
| 126 | + size: tuple[float, float] | None = (640, 480), |
127 | 127 | title: str | None = "$backend", |
128 | 128 | update_mode: UpdateModeEnum = "ondemand", |
129 | 129 | min_fps: float = 0.0, |
@@ -221,7 +221,7 @@ def __del__(self): |
221 | 221 |
|
222 | 222 | _canvas_context = None # set in get_context() |
223 | 223 |
|
224 | | - def get_physical_size(self) -> Tuple[int, int]: |
| 224 | + def get_physical_size(self) -> tuple[int, int]: |
225 | 225 | """Get the physical size of the canvas in integer pixels.""" |
226 | 226 | return self.__size_info["physical_size"] |
227 | 227 |
|
@@ -566,7 +566,7 @@ def _draw_frame_and_present(self): |
566 | 566 |
|
567 | 567 | # %% Primary canvas management methods |
568 | 568 |
|
569 | | - def get_logical_size(self) -> Tuple[float, float]: |
| 569 | + def get_logical_size(self) -> tuple[float, float]: |
570 | 570 | """Get the logical size (width, height) of the canvas in float pixels. |
571 | 571 |
|
572 | 572 | The logical size can be smaller than the physical size, e.g. on HiDPI |
@@ -802,10 +802,10 @@ def request_draw(self, draw_function: Optional[DrawFunction] = None) -> None: |
802 | 802 | def force_draw(self) -> None: |
803 | 803 | self._subwidget.force_draw() |
804 | 804 |
|
805 | | - def get_physical_size(self) -> Tuple[int, int]: |
| 805 | + def get_physical_size(self) -> tuple[int, int]: |
806 | 806 | return self._subwidget.get_physical_size() |
807 | 807 |
|
808 | | - def get_logical_size(self) -> Tuple[float, float]: |
| 808 | + def get_logical_size(self) -> tuple[float, float]: |
809 | 809 | return self._subwidget.get_logical_size() |
810 | 810 |
|
811 | 811 | def get_pixel_ratio(self) -> float: |
|
0 commit comments