Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/11/2011, 12:31
carlos_armikhael
 
Fecha de Ingreso: octubre-2011
Mensajes: 31
Antigüedad: 12 años, 6 meses
Puntos: 7
Ventanas desplegables Python

Buenas me gustaría saber como puedo utilizar la variable "text" que esta contenida en la ventana desplegable... que al seleccionarla y darle aceptar la envié al terminal... si alguien me podría ayudar muchas gracias...

Código Python:
Ver original
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import gtk
  4.  
  5. text = ["ejemplo", "ejemplo2","ejemplo3","ejemplo4"]
  6.  
  7.  
  8. class MyApp():
  9.  
  10.     def __init__(self):
  11.         window = gtk.Window()
  12.         window.set_border_width(0)
  13.         window.set_title("ventana desplegable")
  14.         window.set_size_request(300, 150)
  15.         window.set_resizable(False)
  16.  
  17.         combo = gtk.Combo()
  18.         combo.set_popdown_strings(text)
  19.                
  20.         boton = gtk.Button(stock=gtk.STOCK_OK)
  21.         #boton.connect("clicked", )
  22.    
  23.         vbox = gtk.VBox(gtk.FALSE, 0)
  24.        
  25.         vbox.add(combo)
  26.         vbox.add(boton)
  27.        
  28.         window.add(vbox)
  29.         window.show_all()
  30.  
  31. if __name__ == "__main__":
  32.     app = MyApp()
  33.     gtk.main()