state bits of an event - on unix and mac

Noam Raphael noamr at users.sourceforge.org.replace.org.with.net
Thu Apr 3 18:08:15 EST 2003


Hello,
   I'm writing in Python a wrapper over Tkinter widgets, that will, for 
each event, call all appropriate functions and not just the most 
specific one.
   For this I need to interpret the state variable which is generated 
for each event. The problem is that I've seen no documentation on the 
meaning of the bits of event, and I want my class to work on unix, win 
and mac, so finding it from my experience only won't be too good.
   I think that the mask 2**0 (the least significant bit) is always the 
Shift modifier, 2**1 is always Lock, 2**2 is always Control, 2**8 is 
always B1 ... 2**12 is always B5. The problem is with the Alt and Meta 
modifiers. From what I saw, on Windows Alt is 2**17, but for unix it 
depends on the X modifier map. Do you know how can the script find which 
out of mod1..mod5 is Alt and which is Meta (if there is a Meta)? I would 
prefer using a tcl/python command over calling an external program. 
Also, can you tell me what happens with modifiers on Mac? I don't have 
one, so I have no clue.

Thank you,
Noam Raphael





More information about the Python-list mailing list