elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Python/Gtk] Tutorial Interfaz gráfica de usuario PyGobject
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Python/Gtk] Tutorial Interfaz gráfica de usuario PyGobject  (Leído 2,295 veces)
Softrix18

Desconectado Desconectado

Mensajes: 36


Ver Perfil
[Python/Gtk] Tutorial Interfaz gráfica de usuario PyGobject
« en: 2 Octubre 2013, 23:33 pm »

Buenas Tarde.

Acá le presento un breve tutorial de como vosotro podeis utilizar esta biblioteca.

PyGObject es un módulo dinámico Python que permite a los desarrolladores utilizar el poder de GObject, que forma parte de la plataforma GNOME.

Código
  1. from gi.repository import Gtk
  2.  
  3. class VentanaPrincipal(Gtk.Window):
  4.  
  5.    def __init__(self):
  6.        Gtk.Window.__init__(self)
  7. self.set_title('Menu')
  8. self.connect("delete-event", Gtk.main_quit)
  9. self.show_all()
  10.  
  11. ventana = VentanaPrincipal()
  12. Gtk.main()
  13.  
  14.  

Código
  1.  
  2. from gi.repository import Gtk
  3.  
  4. class About(Gtk.AboutDialog):
  5.  
  6.     def __init__(self):
  7.        Gtk.AboutDialog.__init__(self)
  8.       self.set_name("PyGObject Tutorial")
  9. self.set_program_name('Tutorial Foro elhacker')
  10. self.set_documenters('')
  11. self.set_version("1.0")
  12. self.set_authors('Pablo Cariel')
  13. self.set_website("http://www.google.com")
  14. self.set_copyright("Software Libre - 2013")
  15. self.set_license('')
  16. self.set_logo_icon_name(Gtk.STOCK_ABOUT)
  17. self.run()
  18. self.destroy()
  19.  
  20. class VentanaPrincipal(Gtk.Window):
  21.  
  22.    def __init__(self):
  23.        Gtk.Window.__init__(self)
  24. self.set_title('Ventana Principal')
  25. self.connect("delete-event", Gtk.main_quit)
  26. self.button = Gtk.Button(label="Prueba About")
  27.        self.button.connect("clicked", self.botton)
  28.        self.add(self.button)
  29. self.show_all()
  30.  
  31.    def botton(self, widget):
  32.        About()
  33.  
  34.  
  35.  
  36. ventana = VentanaPrincipal()
  37. Gtk.main()
  38.  


En línea

0xDani


Desconectado Desconectado

Mensajes: 1.077



Ver Perfil
Re: [Python/Gtk] Tutorial Interfaz gráfica de usuario PyGobject
« Respuesta #1 en: 6 Octubre 2013, 14:33 pm »

Bueno, estos dos códigos de ejemplo no están mal (por ejemplo no conocía el uso de la clase AboutDialog). Si tengo tiempo a lo mejor escribo algo sobre la creación de GUIs con GTK 3 y CSS, usando PyGObject.


En línea

I keep searching for something that I never seem to find, but maybe I won't, because I left it all behind!

I code for $$$
Hago trabajos en C/C++
Contactar por PM
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines