A Comprehensive Introduction to Python Programming and ... - MSDL
A Comprehensive Introduction to Python Programming and ... - MSDL
A Comprehensive Introduction to Python Programming and ... - MSDL
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
6.2 Event Types <strong>and</strong> Properties 49 / 75<br />
6.2 Event Types <strong>and</strong> Properties<br />
While event descrip<strong>to</strong>rs can be very specific, Tkinter also supports more general events.<br />
Currently, the following event types are available, <strong>and</strong> can be classified in<strong>to</strong> tree major<br />
categories:<br />
Keyboard events : KeyPress, KeyRelease<br />
Mouse events : But<strong>to</strong>nPress, But<strong>to</strong>nRelease, Motion, Enter, Leave, MouseWheel<br />
Window events : Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, Colourmap,<br />
Gravity, Reparent, Property, Destroy, Activate, Deactivate<br />
Each callback that is bound <strong>to</strong> an event reveices <strong>and</strong> an instance of the Event class<br />
as parameter when it is invoked. The Event class defines the following properties:<br />
Property Description<br />
char pressed character (as a char)(KeyPress, KeyRelease<br />
only)<br />
delta delta of wheel movement (MouseWheel)<br />
focus boolean which indicates whether the window has the<br />
focus (Enter, Leave only)<br />
height height of the exposed window (Configure, Expose<br />
only)<br />
keycode keycode of the pressed key (KeyPress, KeyRelease<br />
only)<br />
keysym keysym of the the event as a string (KeyPress, KeyRelease<br />
only)<br />
keysym num keysym of the event as a number (KeyPress, KeyRelease<br />
only)<br />
num number of the mouse but<strong>to</strong>n pressed (1=LEFT,<br />
2=CENTER, 3=RIGHT, etc.) (But<strong>to</strong>nPress, But<strong>to</strong>n-<br />
Release only)<br />
serial serial number of the event<br />
state state of the event as a number (But<strong>to</strong>nPress, But<strong>to</strong>n-<br />
Release, Enter, KeyPress, KeyRelease, Leave, Motion<br />
only) or string indicating the source of the Visibility<br />
event (one of “VisibilityUnobscured”, “VisibilityPartiallyObscured”,<br />
<strong>and</strong> “VisibilityFullyObscured”<br />
time time at which the event occurred. Under Microsoft<br />
Windows, this is the value returned by the GetTick-<br />
Count( ) API function.<br />
Continued on next page