[pygtk] strange spinbutton behavior
JUAN JOSE ROJO
jjrojoc at gmail.com
Thu Jun 28 07:32:28 WST 2007
2007/6/27, James Dietrich <jdietrch en gmail.com>:
>
> Hi,
>
> In the following program, one click on the spinbutton will
> advance the number displayed by two digits--from '1' to '3'.
> Apparently the 'value-changed' signal gets emitted twice
> when the adj_callback takes some time to do. If I uncomment
> the line with 'return' on it so that it skips the long loop, one
> click advances the number on the spinbutton by one
> number, as expected.
>
> Am I missing something about how spinbuttons work?
>
> Thanks for your help,
> James Dietrich
>
> import gtk
>
> def adj_callback(adj):
> print "Adj Callback"
> #return
> for x in range(10000000): y =3D x * x
>
> win =3D gtk.Window()
> win.connect('delete-event', gtk.main_quit)
>
> adj =3D gtk.Adjustment(1, 1, 100, 1, 1, 0)
> spin =3D gtk.SpinButton(adj, 0, 0)
> spin.connect('value-changed', adj_callback)
spin.connect('change-value', adj_callback)
spin.show()
>
> win.add(spin)
> win.show()
>
> gtk.main()
> _______________________________________________
> pygtk mailing list pygtk en daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
------------ pr=F3xima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20070628/d1081892/at=
tachment.htm
More information about the pygtk
mailing list