tkinter: wait_variable

Bob van der Poel bvdpoel at uniserve.com
Thu Jun 15 12:10:04 EDT 2000


John Grayson wrote:
> 
> In article <39482E96.350D115E at uniserve.com>,
>   Bob van der Poel <bvdpoel at uniserve.com> wrote:
> >
> > How does wait_variable() work? I've got the following in a class:
> >
> >       __marked = []
> >
> >       ....
> >
> >       def mark(self):
> >               a callback to mark certain items
> >               self.__marked.append(x)
> >
> >       def wait(self, root):
> >               root.wait_variable(self.__marked)
> >               return self.__marked
> >
> > and I call it, after setting up,etc:
> >
> >       print myclass.wait(root)
> >
> > However, it never seems to return. With test print statements I have
> > determined that my __marked variable is being updated...but
> > wait_variable() doesn't seem to sense it.
> >
> > --
> >    __
> >   /  )      /         Bob van der Poel
> >  /--<  ____/__        bvdpoel at uniserve.com
> > /___/_(_) /_)         http://users.uniserve.com/~bvdpoel
> >
> >
> 
> You've got to wait for a Tkinter (Tk) variable. There is no ListVar
> class, so you need to wait on an IntVar or BooleanVar, then in your
> mark method, set self.__marked *and* your Tkinter variable...

Ahhh, actually that makes sense! And of course this is clear in the docs
for tkinter as well :). Thanks very much.


-- 
   __
  /  )      /         Bob van der Poel
 /--<  ____/__        bvdpoel at uniserve.com
/___/_(_) /_)         http://users.uniserve.com/~bvdpoel



More information about the Python-list mailing list