Re: PyGTK + Glade = weird problem
Finally solved this stuff, the problem wasnt with glade, the problem was that i was using the destroy event in glade, i just changed the destroy to delete-event and it worked like a charm. thanx :) -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK + Glade = weird problem
We'd need to see your scc.glade file to be sure, but basically, calling the show method on the w_cadcli object only shows it, not the objects it contains. Again, to be clear, showing a container object doesn't automatically show the objects it contains. In glade, use the common tab of the property editor to make sure that the visible property is set to Yes for all of the widgets in the windows you want to show. In general, if you always do that, you'll be able to show or hide the entire window by simply calling show or hide on the window object, like you're trying to do. But this is just a guess; post your scc.glade file if the above advice doesn't work. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK + Glade = weird problem
Oops- I didn't read your question carefully enough. That's probably not the problem. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK + Glade = weird problem
Sorry about that. Your problem is that the show_hide_janela method is setup to be called both on a gtk signal (destroy) and an event(delete_event). Callback methods for events take a slightly different signature than signals; they take one extra argument, which represents the triggering event. When you close the window, the delete_event is triggered, which calls show_hide_janella, but the call fails, because show_hide_janella is called with 3 arguments, when its only expecting 2. So, to fix the code you have posted in the thread you linked, replace the line def show_hide_janela(self,obj): with the line def show_hide_janela(self,obj, event=None): The modified code works on my machine. Hope this helps, Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK + Glade = weird problem
Anyway, now i tried in my glade app and i m getting this error when i try to show the window: GtkWarning: gtk_paint_flat_box: assertion `style-depth == gdk_drawable_get_depth (window)' failed here is the code: class main: def __init__(self): self.principal = gtk.glade.XML(scc.glade) self.w_cadcli = self.principal.get_widget(w_cadcli) dic = {on_principal_destroy : self.DestroyFunction, on_sair_activate : self.DestroyFunction, on_w_cadcli_destroy : self.show_hide_window, on_cadcli_activate : self.show_hide_window} self.principal.signal_autoconnect(dic) principal = self.principal.get_widget(principal) gtk.main() def DestroyFunction(self,*args): gtk.main_quit() def show_hide_window(self,obj,event=None): #if the second window is open hide it, if dont show it if self.w_cadcli.get_property(visible) == True: self.w_cadcli.hide() else: self.w_cadcli.show() return True -- http://mail.python.org/mailman/listinfo/python-list