Thanks Neil , it is working well
-----Original Message-----
From: [email protected] on behalf of Neil Muller
Sent: Sat 4/4/2009 4:14 PM
To: [email protected]
Subject: Re: [pygtk] how to change value in slider
On Fri, Apr 3, 2009 at 7:54 PM, Sibtey Mehdi <[email protected]> wrote:
>
> hi
> I am trying to change the value in the slider bar but it is allowing
> to change the value within the range given in the
> adjustment. if the current values are 1,2,4,5,6,7 then i want slider
> should show 1,2,4,8,16,32,64.how can i do this any one can help me out this
> problem? even the set_value(newvalue) function changes values within the
> lower and upper values but that changes are also not displayed on the
> slider.
Why not hook onto the format_value signal?
Something like:
class Scale(object):
"""A scale that adheres to increment steps"""
def __init__(self,x):
self.set_update_policy(gtk.UPDATE_CONTINUOUS)
self.set_size_request(150,35)
self.connect("format-value", self.display_value)
def display_value(self, widget, value):
return "%d" % 2**(value-1)
(You'll probably also want to override get_value so you get the
displayed value out of the widget.)
--
Neil Muller
[email protected]
I've got a gmail account. Why haven't I become cool?
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/