Other event-related methods

Binding of a handler to an event can happen at various levels using bind, bind_all, bind_class, and tag_bind.

If an event binding is registered to a callback function, the callback function is called with an Event as its first argument. The event argument has the following attributes:

Attribute

Description

Valid for event types

event.serial

Serial number of event.

All

event.num

Mouse button pressed.

ButtonPress and ButtonRelease

event.focus

Whether the window has the focus.

Enter and Leave

event.height

Height of the exposed window.

Configure and Expose

event.width

Width of the exposed window.

Configure and Expose

event.keycode

Keycode of the pressed key.

KeyPress and KeyRelease

event.state

State of the event as a number.

ButtonPress, ButtonRelease, Enter, KeyPress, KeyRelease, Leave, and Motion

event.state

State as a string.

Visibility

event.time

When the event occurred.

All

event.x

It gives the x-position of the mouse.

All

event.y

It gives the y-position of the mouse.

All

event.x_root

It gives the x-position of the mouse on the screen.

ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion

event.y_root

It gives the y-position of the mouse on the screen.

ButtonPress, ButtonRelease, KeyPress, KeyRelease, and Motion

event.char

It gives the pressed character.

KeyPress and KeyRelease

event.keysym

It gives the keysym of the event as a string.

KeyPress and KeyRelease

event.keysym_num

It gives the keysym of the event as a number.

KeyPress and KeyRelease

event.type

Type of the event as a number.

All

event.widget

Widget in which the event occurred.

All

event.delta

Delta of wheel movement.

MouseWheel

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.200.71