@@ -550,15 +550,15 @@ def clipboard_clear(self, **kw):
550550
551551 A widget specified for the optional displayof keyword
552552 argument specifies the target display."""
553- if not kw . has_key ( 'displayof' ) : kw ['displayof' ] = self ._w
553+ if 'displayof' not in kw : kw ['displayof' ] = self ._w
554554 self .tk .call (('clipboard' , 'clear' ) + self ._options (kw ))
555555 def clipboard_append (self , string , ** kw ):
556556 """Append STRING to the Tk clipboard.
557557
558558 A widget specified at the optional displayof keyword
559559 argument specifies the target display. The clipboard
560560 can be retrieved with selection_get."""
561- if not kw . has_key ( 'displayof' ) : kw ['displayof' ] = self ._w
561+ if 'displayof' not in kw : kw ['displayof' ] = self ._w
562562 self .tk .call (('clipboard' , 'append' ) + self ._options (kw )
563563 + ('--' , string ))
564564 # XXX grab current w/o window argument
@@ -619,7 +619,7 @@ def option_readfile(self, fileName, priority = None):
619619 self .tk .call ('option' , 'readfile' , fileName , priority )
620620 def selection_clear (self , ** kw ):
621621 """Clear the current X selection."""
622- if not kw . has_key ( 'displayof' ) : kw ['displayof' ] = self ._w
622+ if 'displayof' not in kw : kw ['displayof' ] = self ._w
623623 self .tk .call (('selection' , 'clear' ) + self ._options (kw ))
624624 def selection_get (self , ** kw ):
625625 """Return the contents of the current X selection.
@@ -628,7 +628,7 @@ def selection_get(self, **kw):
628628 the selection and defaults to PRIMARY. A keyword
629629 parameter displayof specifies a widget on the display
630630 to use."""
631- if not kw . has_key ( 'displayof' ) : kw ['displayof' ] = self ._w
631+ if 'displayof' not in kw : kw ['displayof' ] = self ._w
632632 return self .tk .call (('selection' , 'get' ) + self ._options (kw ))
633633 def selection_handle (self , command , ** kw ):
634634 """Specify a function COMMAND to call if the X
@@ -659,7 +659,7 @@ def selection_own_get(self, **kw):
659659 be provided:
660660 selection - name of the selection (default PRIMARY),
661661 type - type of the selection (e.g. STRING, FILE_NAME)."""
662- if not kw . has_key ( 'displayof' ) : kw ['displayof' ] = self ._w
662+ if 'displayof' not in kw : kw ['displayof' ] = self ._w
663663 name = self .tk .call (('selection' , 'own' ) + self ._options (kw ))
664664 if not name : return None
665665 return self ._nametowidget (name )
@@ -1692,7 +1692,7 @@ def readprofile(self, baseName, className):
16921692 the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
16931693 such a file exists in the home directory."""
16941694 import os
1695- if os . environ . has_key ( 'HOME' ) : home = os .environ ['HOME' ]
1695+ if 'HOME' in os . environ : home = os .environ ['HOME' ]
16961696 else : home = os .curdir
16971697 class_tcl = os .path .join (home , '.%s.tcl' % className )
16981698 class_py = os .path .join (home , '.%s.py' % className )
@@ -1808,7 +1808,7 @@ def place_configure(self, cnf={}, **kw):
18081808 into account
18091809 """
18101810 for k in ['in_' ]:
1811- if kw . has_key ( k ) :
1811+ if k in kw :
18121812 kw [k [:- 1 ]] = kw [k ]
18131813 del kw [k ]
18141814 self .tk .call (
@@ -1900,7 +1900,7 @@ def _setup(self, master, cnf):
19001900 self .master = master
19011901 self .tk = master .tk
19021902 name = None
1903- if cnf . has_key ( 'name' ) :
1903+ if 'name' in cnf :
19041904 name = cnf ['name' ]
19051905 del cnf ['name' ]
19061906 if not name :
@@ -1911,7 +1911,7 @@ def _setup(self, master, cnf):
19111911 else :
19121912 self ._w = master ._w + '.' + name
19131913 self .children = {}
1914- if self .master .children . has_key ( self . _name ) :
1914+ if self ._name in self . master .children :
19151915 self .master .children [self ._name ].destroy ()
19161916 self .master .children [self ._name ] = self
19171917 def __init__ (self , master , widgetName , cnf = {}, kw = {}, extra = ()):
@@ -1934,7 +1934,7 @@ def destroy(self):
19341934 """Destroy this and all descendants widgets."""
19351935 for c in self .children .values (): c .destroy ()
19361936 self .tk .call ('destroy' , self ._w )
1937- if self .master .children . has_key ( self . _name ) :
1937+ if self ._name in self . master .children :
19381938 del self .master .children [self ._name ]
19391939 Misc .destroy (self )
19401940 def _do (self , name , args = ()):
@@ -1962,7 +1962,7 @@ def __init__(self, master=None, cnf={}, **kw):
19621962 extra = ()
19631963 for wmkey in ['screen' , 'class_' , 'class' , 'visual' ,
19641964 'colormap' ]:
1965- if cnf . has_key ( wmkey ) :
1965+ if wmkey in cnf :
19661966 val = cnf [wmkey ]
19671967 # TBD: a hack needed because some keys
19681968 # are not valid as keyword arguments
@@ -2433,10 +2433,10 @@ def __init__(self, master=None, cnf={}, **kw):
24332433 highlightcolor, highlightthickness, relief, takefocus, visual, width."""
24342434 cnf = _cnfmerge ((cnf , kw ))
24352435 extra = ()
2436- if cnf . has_key ( 'class_' ) :
2436+ if 'class_' in cnf :
24372437 extra = ('-class' , cnf ['class_' ])
24382438 del cnf ['class_' ]
2439- elif cnf . has_key ( 'class' ) :
2439+ elif 'class' in cnf :
24402440 extra = ('-class' , cnf ['class' ])
24412441 del cnf ['class' ]
24422442 Widget .__init__ (self , master , 'frame' , cnf , {}, extra )
@@ -3179,7 +3179,7 @@ def __init__(self, master, variable, value, *values, **kwargs):
31793179 self .menuname = menu ._w
31803180 # 'command' is the only supported keyword
31813181 callback = kwargs .get ('command' )
3182- if kwargs . has_key ( 'command' ) :
3182+ if 'command' in kwargs :
31833183 del kwargs ['command' ]
31843184 if kwargs :
31853185 raise TclError , 'unknown option -' + kwargs .keys ()[0 ]
0 commit comments