From 5c8179c69998978439761a2e758d81aab1102ae5 Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Sun, 7 Jun 2020 10:14:51 -0700 Subject: [PATCH 1/4] Add tkinter Event class --- stdlib/3/tkinter/__init__.pyi | 61 ++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index e90a988b2490..faa54f143d79 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -1,4 +1,5 @@ import sys +from enum import Enum from types import TracebackType from typing import Any, Optional, Dict, Callable, Tuple, Type, Union from tkinter.constants import * # noqa: F403 @@ -11,7 +12,65 @@ READABLE: Any WRITABLE: Any EXCEPTION: Any -class Event: ... +class EventType(str, enum.Enum): + Activate: int = ... + ButtonPress: int = ... + ButtonRelease: int = ... + Circulate: int = ... + CirculateRequest: int = ... + ClientMessage: int = ... + Colormap: int = ... + Configure: int = ... + ConfigureRequest: int = ... + Create: int = ... + Deactivate: int = ... + Destroy: int = ... + Enter: int = ... + Expose: int = ... + FocusIn: int = ... + FocusOut: int = ... + GraphicsExpose: int = ... + Gravity: int = ... + KeyPress: int = ... + KeyRelease: int = ... + Keymap: int = ... + Leave: int = ... + Map: int = ... + MapRequest: int = ... + Mapping: int = ... + Motion: int = ... + MouseWheel: int = ... + NoExpose: int = ... + Property: int = ... + Reparent: int = ... + ResizeRequest: int = ... + Selection: int = ... + SelectionClear: int = ... + SelectionRequest: int = ... + Unmap: int = ... + VirtualEvent: int = ... + Visibility: int = ... + +class Event: + serial: int + num: int + focus: bool + height: int + width: int + keycode: int + state: Union[int, str] + time: int + x: int + y: int + x_root: int + y_root: int + char: str + send_event: bool + keysym: str + keysym_num: int + type: EventType + widget: Misc + delta: int def NoDefaultRoot(): ... From 0ea4c3e3d846fd00c7d969a1921254b03ec152be Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Sun, 7 Jun 2020 15:01:46 -0700 Subject: [PATCH 2/4] fixup! Add tkinter Event class --- stdlib/3/tkinter/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index faa54f143d79..098f66bde360 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -12,7 +12,7 @@ READABLE: Any WRITABLE: Any EXCEPTION: Any -class EventType(str, enum.Enum): +class EventType(str, Enum): Activate: int = ... ButtonPress: int = ... ButtonRelease: int = ... From 8844c9264371feaac8e598edd73d49d1afecf18e Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Sun, 7 Jun 2020 15:09:27 -0700 Subject: [PATCH 3/4] fixup! Add tkinter Event class --- stdlib/3/tkinter/__init__.pyi | 74 +++++++++++++++++------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index 098f66bde360..795002151b9d 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -13,43 +13,43 @@ WRITABLE: Any EXCEPTION: Any class EventType(str, Enum): - Activate: int = ... - ButtonPress: int = ... - ButtonRelease: int = ... - Circulate: int = ... - CirculateRequest: int = ... - ClientMessage: int = ... - Colormap: int = ... - Configure: int = ... - ConfigureRequest: int = ... - Create: int = ... - Deactivate: int = ... - Destroy: int = ... - Enter: int = ... - Expose: int = ... - FocusIn: int = ... - FocusOut: int = ... - GraphicsExpose: int = ... - Gravity: int = ... - KeyPress: int = ... - KeyRelease: int = ... - Keymap: int = ... - Leave: int = ... - Map: int = ... - MapRequest: int = ... - Mapping: int = ... - Motion: int = ... - MouseWheel: int = ... - NoExpose: int = ... - Property: int = ... - Reparent: int = ... - ResizeRequest: int = ... - Selection: int = ... - SelectionClear: int = ... - SelectionRequest: int = ... - Unmap: int = ... - VirtualEvent: int = ... - Visibility: int = ... + Activate: str = ... + ButtonPress: str = ... + ButtonRelease: str = ... + Circulate: str = ... + CirculateRequest: str = ... + ClientMessage: str = ... + Colormap: str = ... + Configure: str = ... + ConfigureRequest: str = ... + Create: str = ... + Deactivate: str = ... + Destroy: str = ... + Enter: str = ... + Expose: str = ... + FocusIn: str = ... + FocusOut: str = ... + GraphicsExpose: str = ... + Gravity: str = ... + KeyPress: str = ... + KeyRelease: str = ... + Keymap: str = ... + Leave: str = ... + Map: str = ... + MapRequest: str = ... + Mapping: str = ... + Motion: str = ... + MouseWheel: str = ... + NoExpose: str = ... + Property: str = ... + Reparent: str = ... + ResizeRequest: str = ... + Selection: str = ... + SelectionClear: str = ... + SelectionRequest: str = ... + Unmap: str = ... + VirtualEvent: str = ... + Visibility: str = ... class Event: serial: int From 9ae1a17e5ef070ba58b05abb8e05dea1f6dadb58 Mon Sep 17 00:00:00 2001 From: Christopher Head Date: Sun, 7 Jun 2020 15:19:32 -0700 Subject: [PATCH 4/4] fixup! Add tkinter Event class --- stdlib/3/tkinter/__init__.pyi | 82 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/stdlib/3/tkinter/__init__.pyi b/stdlib/3/tkinter/__init__.pyi index 795002151b9d..c8b3037d8f5f 100644 --- a/stdlib/3/tkinter/__init__.pyi +++ b/stdlib/3/tkinter/__init__.pyi @@ -12,44 +12,45 @@ READABLE: Any WRITABLE: Any EXCEPTION: Any -class EventType(str, Enum): - Activate: str = ... - ButtonPress: str = ... - ButtonRelease: str = ... - Circulate: str = ... - CirculateRequest: str = ... - ClientMessage: str = ... - Colormap: str = ... - Configure: str = ... - ConfigureRequest: str = ... - Create: str = ... - Deactivate: str = ... - Destroy: str = ... - Enter: str = ... - Expose: str = ... - FocusIn: str = ... - FocusOut: str = ... - GraphicsExpose: str = ... - Gravity: str = ... - KeyPress: str = ... - KeyRelease: str = ... - Keymap: str = ... - Leave: str = ... - Map: str = ... - MapRequest: str = ... - Mapping: str = ... - Motion: str = ... - MouseWheel: str = ... - NoExpose: str = ... - Property: str = ... - Reparent: str = ... - ResizeRequest: str = ... - Selection: str = ... - SelectionClear: str = ... - SelectionRequest: str = ... - Unmap: str = ... - VirtualEvent: str = ... - Visibility: str = ... +if sys.version_info >= (3, 6): + class EventType(str, Enum): + Activate: str = ... + ButtonPress: str = ... + ButtonRelease: str = ... + Circulate: str = ... + CirculateRequest: str = ... + ClientMessage: str = ... + Colormap: str = ... + Configure: str = ... + ConfigureRequest: str = ... + Create: str = ... + Deactivate: str = ... + Destroy: str = ... + Enter: str = ... + Expose: str = ... + FocusIn: str = ... + FocusOut: str = ... + GraphicsExpose: str = ... + Gravity: str = ... + KeyPress: str = ... + KeyRelease: str = ... + Keymap: str = ... + Leave: str = ... + Map: str = ... + MapRequest: str = ... + Mapping: str = ... + Motion: str = ... + MouseWheel: str = ... + NoExpose: str = ... + Property: str = ... + Reparent: str = ... + ResizeRequest: str = ... + Selection: str = ... + SelectionClear: str = ... + SelectionRequest: str = ... + Unmap: str = ... + VirtualEvent: str = ... + Visibility: str = ... class Event: serial: int @@ -68,7 +69,10 @@ class Event: send_event: bool keysym: str keysym_num: int - type: EventType + if sys.version_info >= (3, 6): + type: EventType + else: + type: str widget: Misc delta: int