python-glade
Milton Galo Patricio
minoztro en gmail.com
Vie Nov 10 23:51:36 CET 2006
hola:
al vuelo me parece que debiera ser algo parecido como esto:
import os
import gtk
from gtk import glade
import gnome
class MainWindow:
def __init__(self, gui):
GTK_GUI=gui
self.mainGlade = glade.XML( GTK_GUI )
self.mainGlade.signal_connect( 'destroy', self.destroy )
def run(self):
gtk.main()
def destroy(self, widget, data=None):
gtk.main_quit()
def on_btnNew_clicked( self, widget, *args ):
self.destroy(widget)
if __name__ == '__main__':
if os.name == 'nt':
print "No Implementado"
import sys
sys.exit(1)
else:
main = MainWindow('gReport1.glade')
main.run()
espero que sirva, no lo he interpretado, salu2!!
2006/11/9, Rafael Rodríguez Puente <rafaelrp en uci.cu>:
> Hola lista, tengo el siguiente problema:
> import os
>
> import gtk
> from gtk import glade
> import gnome
>
> if os.name == 'nt':
> print "No Implementado"
> import sys
> sys.exit(1)
> else:
> GTK_GUI = 'gReport1.glade'
>
> class MainWindow:
>
> def __init__( self ):
> self.mainGlade = glade.XML( GTK_GUI )
> # Conectar los eventos del formulario principal del .glade con
> #sus respectivas funciones en Python.
> self.mainGlade.signal_connect( 'destroy', self.destroy )
> # Inicia el Bucle de GTK
> def run(self):
> #gtk.AboutDialog()
> gtk.main()
>
> # Destruye el Widget Principal termina la Aplicacion.
> def destroy(self, widget, data=None):
> gtk.main_quit()
>
> def on_btnNew_clicked( self, widget, *args ):
> self.destroy(widget)
>
> if __name__ == '__main__':
> main = MainWindow()
> main.run()
>
> cuando ejecuto la aplicación, me da la siguiente salida:
> /home/rafael/Proyectos/Python/GReport/main-test.py:17: GtkWarning:
> gtk_widget_set_name: assertion `GTK_IS_WIDGET (widget)' failed
> self.mainGlade = glade.XML( GTK_GUI )
> /home/rafael/Proyectos/Python/GReport/main-test.py:17: GtkWarning:
> gtk_widget_get_accessible: assertion `GTK_IS_WIDGET (widget)' failed
> self.mainGlade = glade.XML( GTK_GUI )
> /home/rafael/Proyectos/Python/GReport/main-test.py:17: Warning:
> gsignal.c:1617: signal `destroy' is invalid for instance `0x8148c78'
> self.mainGlade = glade.XML( GTK_GUI )
>
> He probado de todo y nada, les agradecería mucho si me pudieran ayudar,
> y si no pueden también.
>
> Si tiene alguna de documentación que hable de como utilizar los archivos
> de glade, por favor, sera bienvenida.
> Gracias de antemano, Rafael.
> "El software, al igual que el sexo,
>
> es mejor cuando es libre"
> _______________________________________________
> Python-es mailing list
> Python-es en aditel.org
> http://listas.aditel.org/listinfo/python-es
>
--
Milton Inostroza Aguilera
Más información sobre la lista de distribución Python-es