Dear list!

This is my first message in this list, I hope I'm not hitting a FAQ ...

I want to use (and I actually did already use) PyGTK (and Glade) to
create GUIs for psychoacoustic listening tests.

Now I'm searching for a way to create a slider (gtk.HScale or
gtk.VScale or something similar) with some specific features:

1) tick marks with labels (solved, but causing another problem)

2) disable "page-wise" movement (solved)

3) hidden "thumb", appearing on first click

I want to tell you what I tried to reach those goals and I hope you
can help me where I didn't suceed:

ad 1)
This was easy, given a sufficiently recent version of PyGTK, because
there is the gtk.Scale.add_mark() function, which nicely does what I
want ... almost.
The problem is that the "thumb" snaps to the tick marks if I move it
within their close vicinity.
Is there a way to disable this "snapping"?
I found out that the style setting "GtkScale::slider-length" seems to
have an effect on the "snapping distance", i.e. if it's set to zero,
no snapping occurs, but also the "thumb" disappears!

ad 2)
I found out that I wanted the behaviour of the middle mouse button to
be realized on any mouse button, therefore I wrote a little function
...

def fake_middle_button(widget, event):
    event.button = 2
    return False

... and connected it to the "button-press-event" and the
"button-release-event" of the gtk.Scale.
This seems to work as intended, but maybe it's not the way this should be done?

ad 3)
I want to use the slider for a test subject to rate some test stimuli
which are presented to her/him.
They should not be biased in any form, so I don't want the slider to
show its value in the beginning.
Therefore I want to hide the "thumb" initially, and show only the
"through" and the tick marks to the user. Once the user clicks on the
"through", the "thumb" should appear and from then on act "normally".
I guess I could set the style attribute "GtkScale::slider-length" to
zero to hide the thing and then on a "button-press-event" set it to
another value, let's say 20.
This may work, but it affects the "snapping" problem described in 1).

Do you know another way to do this?
Any thoughts?
Do you happen to know a custom widget which could be used instead of gtk.Scale?

cheers,
Matthias
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to