Re: Destroy Spin Button on value change



Jay Bloodworth <jay dokodiner com> writes: 
> When I run the prog and lower the spin value to 0 (using the down
> arrow), the following error loops on the console until I terminate the
> app (WM close works fine):
> 
> Gtk-CRITICAL **: file gtkspinbutton.c: line 1275
> (gtk_spin_button_real_spin): assertion `GTK_IS_SPIN_BUTTON
> (spin_button)' failed.
> 
> >From looking through the source, it appears that the handler for the
> button press event emits the adjustment value changed signal before
> updating the spin button; thus the spin button is gone before it get's
> to that code, hence the error in real_spin.
> 
> So how can I fix it?  I couldn't find an entry point between the
> value-changed emmision and real_spin to head off the error.  I could use
> 
> the value changed handler to set a flag or set up another signal handler
> 
> to delete the spin button 'later', but what can I hook into that will be
> 
> called immediately after the spin button has finished updating but not
> before.

Just add a reference to the spin button. I'm not sure how to do that
from PyGTK though. In C, gtk_object_ref (spinbutton).

Or use the idle_add solution Paul suggested, that works fine too.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]