Skip to content

Missing attributes on tkinter.Events, tkinter.ttk.Frame, and tkinter.ttk.Treeview #1631

@jcrmatos

Description

@jcrmatos

Hello,

Mypy complains that tkinter.Event doesn't have x_root/y_root attributes, which is incorrect.
Here is an example (abridged) of code that mypy complains about.

...
    def show(self, event):
        # Position the tooltip below and to the rigth of the cursor (16x16).
        # Mypy returns an error Event has no attr x_root/y_root.
        x_pos = event.x_root + 16  # type: ignore
        y_pos = event.y_root + 16  # type: ignore
        self.geometry('+{0}+{1}'.format(x_pos, y_pos))

        self.deiconify()
        self.visible = True

        self.after(self.delay, self.hide)  # Milliseconds.
...
widget.bind('<Enter>', self.show)
...

Best regards,

JM

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions