Tkinter scrollbar question

Laura Creighton lac at strakt.com
Fri Nov 9 13:16:48 EST 2001


I now understand more about my scrollbar problem.  I said, fine, you got
4 arguments, tell me what they were:
 
    def yview(self, x, y, z):
        print x, y, z

And I got this from python:
scroll -1 units
scroll 1 units

Okay.  I now have what I want, it's just the second parameter.

But then I click on and try to drag the slider part:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python2.1/lib-tk/Tkinter.py", line 1289, in __call__
    return apply(self.func, args)
TypeError: yview() takes exactly 4 arguments (3 given)
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python2.1/lib-tk/Tkinter.py", line 1289, in __call__
    return apply(self.func, args)
TypeError: yview() takes exactly 4 arguments (3 given)

What did you get passed _this_ _time_ oh wretched function?

moveto 0.331164133333
moveto 0.328994943333
moveto 0.326825743333
moveto 0.324656543333

-------------------------

Depending on what I did to cause it to be called, I am going to get
called with a varying number of very different arguments.  Which
Fredrik Lundh _did_ tell me, but I didn't understand until I had 
made the function tell me what was going on.

What puzzles me now is why 

    def yview(self, delta):
        # this works until you do a yscrollbar.set
        if int(delta) == 1:
            self.move_everybody_up()
        if int(delta) == -1:
            self.move_everybody_down()

ever worked at all.

Laura




More information about the Python-list mailing list