Improve turtle.ScrolledCanvas (#6757)

This commit is contained in:
Akuli
2022-01-09 21:24:45 +02:00
committed by GitHub
parent 4e046163b5
commit e743ea9ca7
2 changed files with 19 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
from tkinter import Canvas, Frame, PhotoImage
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
from typing import Any, Callable, ClassVar, Sequence, TypeVar, Union, overload
# Note: '_Color' is the alias we use for arguments and _AnyColor is the
@@ -18,7 +18,17 @@ _PolygonCoords = Sequence[tuple[float, float]]
# Vec2D is actually a custom subclass of 'tuple'.
Vec2D = tuple[float, float]
class ScrolledCanvas(Frame): ...
# Does not actually inherit from Canvas, but dynamically gets all methods of Canvas
class ScrolledCanvas(Canvas, Frame): # type: ignore[misc]
bg: str
hscroll: Scrollbar
vscroll: Scrollbar
def __init__(
self, master: Misc | None, width: int = ..., height: int = ..., canvwidth: int = ..., canvheight: int = ...
) -> None: ...
canvwidth: int
canvheight: int
def reset(self, canvwidth: int | None = ..., canvheight: int | None = ..., bg: str | None = ...) -> None: ...
class TurtleScreenBase:
cv: Canvas

View File

@@ -288,6 +288,11 @@ codecs.StreamReaderWriter.\w+
codecs.StreamRecoder.\w+
urllib.response.addbase.\w+
# Dynamically created, has unnecessary *args
turtle.ScrolledCanvas.find_all
turtle.ScrolledCanvas.select_clear
turtle.ScrolledCanvas.select_item
# Unnecessary re-exports
asyncore\.E[A-Z]+ # re-exported from errno
asyncore.errorcode # re-exported from errno
@@ -413,6 +418,8 @@ pipes.Template.open_r
pipes.Template.open_w
sunau.Au_read.initfp
sunau.Au_write.initfp
turtle.ScrolledCanvas.adjustScrolls
turtle.ScrolledCanvas.onResize
wave.Wave_read.initfp
wave.Wave_write.initfp
@@ -704,5 +711,4 @@ tkinter.tix.ScrolledText
tkinter.tix.ScrolledWindow
tkinter.tix.Shell
tracemalloc.BaseFilter
turtle.ScrolledCanvas\..+
turtle.TNavigator.speed