From 88b02cf346da9c648bddd762d49fae9e33f9a6c7 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 5 Mar 1998 20:12:18 +0000 Subject: Use a better way to bind the checkext instance variable to a check button widget, not involving a __getattr__() method but a callback on the widget. --- Tools/webchecker/wcgui.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Tools/webchecker/wcgui.py b/Tools/webchecker/wcgui.py index 10c77d0..027718f 100755 --- a/Tools/webchecker/wcgui.py +++ b/Tools/webchecker/wcgui.py @@ -120,10 +120,11 @@ class CheckerWindow(webchecker.Checker): self.__step = Button(self.__controls, text="Check one", command=self.step) self.__step.pack(side=LEFT) - self.__cv = BooleanVar() - self.__cv.set(1) + self.__cv = BooleanVar(parent) + self.__cv.set(self.checkext) self.__checkext = Checkbutton(self.__controls, variable=self.__cv, - text="Check nonlocal links") + command=self.update_checkext, + text="Check nonlocal links",) self.__checkext.pack(side=LEFT) self.__reset = Button(self.__controls, text="Start over", command=self.reset) self.__reset.pack(side=LEFT) @@ -144,17 +145,12 @@ class CheckerWindow(webchecker.Checker): self.__errors = ListPanel(mp, "Pages w/ bad links", self.showinfo) self.__details = LogPanel(mp, "Details") webchecker.Checker.__init__(self) - del self.checkext # See __getattr__ below if root: root = string.strip(str(root)) if root: self.suggestroot(root) self.newstatus() - def __getattr__(self, name): - if name != 'checkext': raise AttributeError, name - return self.__cv.get() - def reset(self): webchecker.Checker.reset(self) for p in self.__todo, self.__done, self.__bad, self.__errors: @@ -299,6 +295,9 @@ class CheckerWindow(webchecker.Checker): self.__status.config(text="Status: "+self.status()) self.__parent.update() + def update_checkext(self): + self.checkext = self.__cv.get() + class ListPanel: @@ -395,7 +394,7 @@ class MultiPanel: self.panels = {} def addpanel(self, name, on=0): - v = StringVar() + v = StringVar(self.parent) if on: v.set(name) else: -- cgit v0.12