Problem with Tkinter scrollbar callback

Ivan Van Laningham ivanlan9 at gmail.com
Thu Jan 24 18:58:05 EST 2008


Hi All--
That helps.  Doing a get() on the scrollbar before a set(0.0,0.0)
returns a 4-tuple:  (0.0, 0.0, 0.0, 0.0)  !  I did the set(0.0,0.0)
and now the callback gets the correct number of arguments.

However, I'm still getting the weird behaviour when clicking the
arrowheads--and the heads are all I want.  They act like they've been
set to a keybounce timeout of about a millisecond. ...  The arrow
click increments the number of cells in a table row (effectively), and
it shoots up from 5 to 26 columns almost instantly (that's the
internal max I set).

Metta,
Ivan

On Jan 24, 2008 4:27 PM, Russell E. Owen <rowen at cesmail.net> wrote:
> In article <mailman.1052.1201215005.896.python-list at python.org>,
>
>  "Ivan Van Laningham" <ivanlan9 at gmail.com> wrote:
>
> > Hi All--
> > I'm having two problems with the scrollbar callback on linux systems
> > (Fedora 7, Suse 10.1,2 and 3 all exhibit the issues).
> >
> > Problem one:  on Windows, the callback is called with the arguments as
> > specified in the doc:  "scroll", "1" or "-1", "units".  When I run the
> > identical code on linux, the callback is invoked with only one
> > argument, "1" or "-1".  Here's a small program which demos the
> > problem:
> >
> > ========begin============
> > #!/usr/bin/env python
> >
> > from Tkinter import *
> > import sys
> >
> > def die(event):
> >     sys.exit(0)
> > def sDoit(*args):
> >   for i in args:
> >     print "scrollbar:",i, type(i)
> > root=Tk()
> > f=Frame(root)
> > f.pack(expand=1,fill=BOTH)
> > button=Button(f,width=25)
> > button["text"]="Quit"
> > button.bind("<Button>",die)
> > button.pack()
> > xb=Scrollbar(f,orient=HORIZONTAL,command=sDoit)
> > xb.pack()
> > root.mainloop()
> > =============end===========
> >
> > On Windows, it produces the correct output
> >
> > scrollbar: scroll <type 'str'>
> > scrollbar: 1 <type 'str'>
> > scrollbar: units <type 'str'>
> >
> > but on linux, it produces
> >
> > scrollbar: 1 <type 'str'>
>
> I see the same bad thing on our RedHat Enteprise unix system which has
> the default tcl/tk 8.4.6. However I found that if you send the scrollbar
> the "set" command first then it behaves normally. I think it just starts
> out in a funny state where it has no idea how to display itself.
>
> -- Russell
>
> (P.s. it works fine on my MacOS X 10.4.11 system with default tcl 8.4.7
> or with add-on 8.4.14).
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Ivan Van Laningham
God N Locomotive Works
http://www.pauahtun.org/
http://www.python.org/workshops/1998-11/proceedings/papers/laningham/laningham.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours



More information about the Python-list mailing list