@@ -216,7 +216,7 @@ def dispatch(self, event):
216216 if self .do_dialogevent (event ):
217217 return
218218 (what , message , when , where , modifiers ) = event
219- if eventname . has_key ( what ) :
219+ if what in eventname :
220220 name = "do_" + eventname [what ]
221221 else :
222222 name = "do_%d" % what
@@ -247,7 +247,7 @@ def do_dialogevent(self, event):
247247 gotone , dlg , item = DialogSelect (event )
248248 if gotone :
249249 window = dlg .GetDialogWindow ()
250- if self ._windows . has_key ( window ) :
250+ if window in self ._windows :
251251 self ._windows [window ].do_itemhit (item , event )
252252 else :
253253 print 'Dialog event for unknown dialog'
@@ -261,7 +261,7 @@ def do_mouseDown(self, event):
261261 #
262262 # Find the correct name.
263263 #
264- if partname . has_key ( partcode ) :
264+ if partcode in partname :
265265 name = "do_" + partname [partcode ]
266266 else :
267267 name = "do_%d" % partcode
@@ -276,7 +276,7 @@ def do_mouseDown(self, event):
276276 if hasattr (MacOS , 'HandleEvent' ):
277277 MacOS .HandleEvent (event )
278278 return
279- elif self ._windows . has_key ( wid ) :
279+ elif wid in self ._windows :
280280 # It is a window. Hand off to correct window.
281281 window = self ._windows [wid ]
282282 try :
@@ -363,7 +363,7 @@ def do_key(self, event):
363363 else :
364364 # See whether the front window wants it
365365 w = MyFrontWindow ()
366- if w and self ._windows . has_key ( w ) :
366+ if w and w in self ._windows :
367367 window = self ._windows [w ]
368368 try :
369369 do_char = window .do_char
@@ -378,7 +378,7 @@ def do_char(self, c, event):
378378 def do_updateEvt (self , event ):
379379 (what , message , when , where , modifiers ) = event
380380 wid = WhichWindow (message )
381- if wid and self ._windows . has_key ( wid ) :
381+ if wid and wid in self ._windows :
382382 window = self ._windows [wid ]
383383 window .do_rawupdate (wid , event )
384384 else :
@@ -388,7 +388,7 @@ def do_updateEvt(self, event):
388388 def do_activateEvt (self , event ):
389389 (what , message , when , where , modifiers ) = event
390390 wid = WhichWindow (message )
391- if wid and self ._windows . has_key ( wid ) :
391+ if wid and wid in self ._windows :
392392 window = self ._windows [wid ]
393393 window .do_activate (modifiers & 1 , event )
394394 else :
@@ -408,7 +408,7 @@ def do_osEvt(self, event):
408408 def do_suspendresume (self , event ):
409409 (what , message , when , where , modifiers ) = event
410410 wid = MyFrontWindow ()
411- if wid and self ._windows . has_key ( wid ) :
411+ if wid and wid in self ._windows :
412412 window = self ._windows [wid ]
413413 window .do_activate (message & 1 , event )
414414
@@ -432,7 +432,7 @@ def do_unknownevent(self, event):
432432 def printevent (self , event ):
433433 (what , message , when , where , modifiers ) = event
434434 nicewhat = repr (what )
435- if eventname . has_key ( what ) :
435+ if what in eventname :
436436 nicewhat = eventname [what ]
437437 print nicewhat ,
438438 if what == kHighLevelEvent :
@@ -512,7 +512,7 @@ def fixmenudimstate(self):
512512 label , shortcut , callback , kind = menu .items [i ]
513513 if type (callback ) == types .StringType :
514514 wid = MyFrontWindow ()
515- if wid and self .parent ._windows . has_key ( wid ) :
515+ if wid and wid in self .parent ._windows :
516516 window = self .parent ._windows [wid ]
517517 if hasattr (window , "domenu_" + callback ):
518518 menu .menu .EnableMenuItem (i + 1 )
@@ -528,7 +528,7 @@ def fixmenudimstate(self):
528528 pass
529529
530530 def dispatch (self , id , item , window , event ):
531- if self .menus . has_key ( id ) :
531+ if id in self .menus :
532532 self .menus [id ].dispatch (id , item , window , event )
533533 else :
534534 if DEBUG : print "MenuBar.dispatch(%d, %d, %s, %s)" % \
@@ -607,7 +607,7 @@ def dispatch(self, id, item, window, event):
607607 else :
608608 # callback is string
609609 wid = MyFrontWindow ()
610- if wid and self .bar .parent ._windows . has_key ( wid ) :
610+ if wid and wid in self .bar .parent ._windows :
611611 window = self .bar .parent ._windows [wid ]
612612 if hasattr (window , "domenu_" + callback ):
613613 menuhandler = getattr (window , "domenu_" + callback )
0 commit comments