Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2011, 13:30
Avatar de Lautaro_eb
Lautaro_eb
 
Fecha de Ingreso: mayo-2010
Ubicación: Bariloche, Argentina
Mensajes: 284
Antigüedad: 14 años
Puntos: 24
Sonrisa Añadir botones dinamicamente. GTK

Buenas hoy vengo con una incógnita, Es la siguiente: Como añadir botones dinamicamente con gtk. Ej: al dar click en un boton que cree otro. Este es mi Code para que vean o si quieren usarlo para seguir el ejemplo.
Desde ya muchas gracias.
Código Python:
Ver original
  1. #! /usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3.  
  4. import pygtk
  5. pygtk.require("2.0")
  6. import gtk
  7. import gtk.glade
  8.  
  9. class test:
  10.     def __init__(self):
  11.         #Abriendo
  12.         self.wTree = gtk.glade.XML("linkiWork.glade")
  13.        
  14.         self.wTree.signal_autoconnect(self)
  15.        
  16.         self.window = self.wTree.get_widget("window1")
  17.        
  18.         self.window.show()
  19.     #Aca Estaba Provando pero no funciona.
  20.     def nuevo(self, *args):
  21.         boton = gtk.Button("Nuevo jeje");
  22.         boton.connect("clicked",self.nuevo)
  23.         self.wTree.get_widget("vbox1").add(boton)
  24.  
  25.        
  26.         print "Provando che ..."
  27.        
  28. if __name__ == "__main__":
  29.     test()
  30.     gtk.main()
__________________
Mi emprendimiento: Software BRC
Youtube: Tutoriales de programación y electrónica.