GTK app with scrolled window crashing trying to show a widget inside



Hi,

I'm programming a gtk-app with python and pygtk.
my app consists of a gtk.scrolledwindow and several widgets packed into
it horizontally. i want to make one of those widgets visible from
another thread (when a button is pushed on a joystick).
therefore i get the allocation of the widget and the adjustment of the
scrolledwindow and make use of the gtk.Adjustment.clamp_page function to
make sure the widget is visible on the page.

def set_focus(self):
                adjust = self.scrolled_window.get_hadjustment()
                x_pos = float(self.allocation.x)
                x_pos_width = float(self.allocation.x + self.allocation.width)
                adjust.clamp_page(x_pos, x_pos_width)

this works fine for sometime, but then some parts  of the window are not
repainted properly and the app crashes with a X Window System Error:
it's not always the same Error but one of those:
"BadDrawable", "BadIDChoice", "RenderBadPicture"...
I guess that there is a problem with gtk.main() not knowing it has to
refresh some areas of the window.... But I'm pretty desperate here!

Any help is very appreciated,
Moritz Renftle



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