[pygtk] scaling in slider
Timo
timomlists at gmail.com
Wed Mar 25 02:48:36 WST 2009
A.T.Hofkamp schreef:
> Sibtey Mehdi wrote:
>
>> Hi all
>> i am newbie to pygtk i am trying to add the slider in my application. i want the increment shuold be like
>> 2,4,8,16, 32,64.how can i do this. i am doing by this way but it is not working fine.
>> x = 1
>> adj = gtk.Adjustment(1,1, 64, 2, 2, 0)
>> hscale = gtk.HScale(adj)
>> hscale.connect("value_changed", cb_digits_scale)
>>
>> def cb_digits_scale(hscale):
>> x = adj.get_value()
>> value = x*2
>> adj.set_value(value)
>>
>> can anyone suggest me?
>>
>
> Last year I tried to implement a logarithmic scale too, and succeeded partly.
>
> I used a linear scale for the widget (in your case 1 .. 6), and use that value
> internally.
>
> To get the desired output to the user of the value, I used a conversion
> function (in your case 2 << value).
>
>
>
> What breaks here is that there seems no way to get the slider display the
> logarithmic scale rather than the linear one.
> I 'fixed' this by not displaying a number at all.
>
Can't you just add a label next to the scale and set the label's text?
>
> Sincerely,
> Albert
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
More information about the pygtk
mailing list