-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add tkinter Event class #4200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tkinter Event class #4200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,69 @@ READABLE: Any | |
WRITABLE: Any | ||
EXCEPTION: Any | ||
|
||
class Event: ... | ||
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 | ||
num: int | ||
focus: bool | ||
height: int | ||
width: int | ||
keycode: int | ||
state: Union[int, str] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How did you get the type for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For events of type |
||
time: int | ||
x: int | ||
y: int | ||
x_root: int | ||
y_root: int | ||
char: str | ||
send_event: bool | ||
keysym: str | ||
keysym_num: int | ||
if sys.version_info >= (3, 6): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are at least some code paths where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are those just the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, not familiar with the module, but I was checking against: https://github.com/python/cpython/blob/d31b376bc85dded9d059259737b204e544707d07/Lib/tkinter/__init__.py#L1587-L1592 where if some lookups fail, we end up with the (presumably) str argument. |
||
type: EventType | ||
else: | ||
type: str | ||
widget: Misc | ||
delta: int | ||
|
||
def NoDefaultRoot(): ... | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.