@@ -567,6 +567,36 @@ def _report_exception(self):
567567 exc , val , tb = sys .exc_type , sys .exc_value , sys .exc_traceback
568568 root = self ._root ()
569569 root .report_callback_exception (exc , val , tb )
570+ # These used to be defined in Widget:
571+ def config (self , cnf = None , ** kw ):
572+ # XXX ought to generalize this so tag_config etc. can use it
573+ if kw :
574+ cnf = _cnfmerge ((cnf , kw ))
575+ elif cnf :
576+ cnf = _cnfmerge (cnf )
577+ if cnf is None :
578+ cnf = {}
579+ for x in self .tk .split (
580+ self .tk .call (self ._w , 'configure' )):
581+ cnf [x [0 ][1 :]] = (x [0 ][1 :],) + x [1 :]
582+ return cnf
583+ if type (cnf ) is StringType :
584+ x = self .tk .split (self .tk .call (
585+ self ._w , 'configure' , '-' + cnf ))
586+ return (x [0 ][1 :],) + x [1 :]
587+ apply (self .tk .call , (self ._w , 'configure' )
588+ + self ._options (cnf ))
589+ configure = config
590+ def cget (self , key ):
591+ return self .tk .call (self ._w , 'cget' , '-' + key )
592+ __getitem__ = cget
593+ def __setitem__ (self , key , value ):
594+ Widget .config (self , {key : value })
595+ def keys (self ):
596+ return map (lambda x : x [0 ][1 :],
597+ self .tk .split (self .tk .call (self ._w , 'configure' )))
598+ def __str__ (self ):
599+ return self ._w
570600
571601class CallWrapper :
572602 def __init__ (self , func , subst , widget ):
@@ -710,8 +740,6 @@ def destroy(self):
710740 global _default_root
711741 if _default_root is self :
712742 _default_root = None
713- def __str__ (self ):
714- return self ._w
715743 def readprofile (self , baseName , className ):
716744 import os
717745 if os .environ .has_key ('HOME' ): home = os .environ ['HOME' ]
@@ -927,35 +955,6 @@ def __init__(self, master, widgetName, cnf={}, kw={}, extra=()):
927955 (widgetName , self ._w ) + extra + self ._options (cnf ))
928956 for k , v in classes :
929957 k .config (self , v )
930- def config (self , cnf = None , ** kw ):
931- # XXX ought to generalize this so tag_config etc. can use it
932- if kw :
933- cnf = _cnfmerge ((cnf , kw ))
934- elif cnf :
935- cnf = _cnfmerge (cnf )
936- if cnf is None :
937- cnf = {}
938- for x in self .tk .split (
939- self .tk .call (self ._w , 'configure' )):
940- cnf [x [0 ][1 :]] = (x [0 ][1 :],) + x [1 :]
941- return cnf
942- if type (cnf ) is StringType :
943- x = self .tk .split (self .tk .call (
944- self ._w , 'configure' , '-' + cnf ))
945- return (x [0 ][1 :],) + x [1 :]
946- apply (self .tk .call , (self ._w , 'configure' )
947- + self ._options (cnf ))
948- configure = config
949- def cget (self , key ):
950- return self .tk .call (self ._w , 'cget' , '-' + key )
951- __getitem__ = cget
952- def __setitem__ (self , key , value ):
953- Widget .config (self , {key : value })
954- def keys (self ):
955- return map (lambda x : x [0 ][1 :],
956- self .tk .split (self .tk .call (self ._w , 'configure' )))
957- def __str__ (self ):
958- return self ._w
959958 def destroy (self ):
960959 for c in self .children .values (): c .destroy ()
961960 if self .master .children .has_key (self ._name ):
0 commit comments