On 28-06-10 09:05, [email protected] wrote: > How to solve this error . > GtkWarning: Attempting to add a widget with type GtkButton to a > GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one > widget at a time; it already contains a widget of type GtkLabel > I have a idle with a windows and label . > I want to add news widgets > A gtk.Bin can hold only one widget. To add more, you need to add a container to the window and pack widgets in it.
See the reference manual[0] and/or tutorial[1] for gtk.HBox(), gtk.VBox() and gtk.Table() . And see gtk.ButtonBox() to pack a row of buttons. Cheers, Timo [0] http://www.pygtk.org/docs/pygtk/index.html [1] http://www.pygtk.org/pygtk2tutorial/index.html > Regards > > This is the source code : > > #!/usr/bin/python > import gtk > > def visibility_handler(window): > visible = window.get_property("visible") > > if visible: > window.hide() > else: > window.show() > > def activate_callback(icon, window): > visibility_handler(window) > > def delete_callback(window, event): > visibility_handler(window) > > > > window = gtk.Window() > window.connect("delete-event", delete_callback) > > > label = gtk.Label("Some text") > label.show() > window.add(label) > > button = gtk.Button("Quit") > button.show() > window.add(button) > button = gtk.Button("Set") > button.show > window.add(button) > > > icon = gtk.StatusIcon() > icon.set_from_stock(gtk.STOCK_YES) > icon.connect("activate", activate_callback, window) > _______________________________________________ > 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/
