Ciao Loris Grazie 1000, comunque ho provato facendo come hai dato, ma il risultato non cambia, forse sono io che svaglio, ma sai sono ai primi passi.
Questo è il mio codice ============================================================ #/usr/bin/env python try: import gtk import pygtk pygtk.require('2.0') except: import sys print "Error importing gtk or pygtk" sys.exit(1) class Base: def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("my example window") self.window.set_size_request(500,500) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_icon_from_file("apache.png"); self.window.connect("destroy",gtk.main_quit) self.image = gtk.Image() #self.image = gtk.gdk.pixbuf_new_from_file("../Pictures/porta.jpg") self.image.set_from_file("../Pictures/porta.jpg") fixe = gtk.Fixed() #fixe.put(fixe,100,90) #fixe.add(fixe) self.window.show_all() def main(self): gtk.main() if __name__ == "__main__": base = Base() base.main() ============================================================ Il giorno 11 aprile 2013 13:03, <python-requ...@lists.python.it> ha scritto: > Invia le richieste di iscrizione alla lista Python all'indirizzo > python@lists.python.it > > Per iscriverti o cancellarti attraverso il web, visita > http://lists.python.it/mailman/listinfo/python > oppure, via email, manda un messaggio con oggetto `help' all'indirizzo > python-requ...@lists.python.it > > Puoi contattare la persona che gestisce la lista all'indirizzo > python-ow...@lists.python.it > > Se rispondi a questo messaggio, per favore edita la linea dell'oggetto > in modo che sia più utile di un semplice "Re: Contenuti del digest > della lista Python..." > > > Argomenti del Giorno: > > 1. Re: Digest di Python, Volume 86, Numero 18 (emmanuel segura) > 2. Re: Digest di Python, Volume 86, Numero 18 (orciml) > 3. Re: Digest di Python, Volume 86, Numero 18 (orciml) > 4. Re: Digest di Python, Volume 86, Numero 18 (orciml) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 11 Apr 2013 12:34:29 +0200 > From: emmanuel segura <emi2f...@gmail.com> > To: python@lists.python.it > Subject: Re: [Python] Digest di Python, Volume 86, Numero 18 > Message-ID: > < > cae7pj3basubr5whuycuvzs-g67jd6gvk3ejchrbpfmqt-pa...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Ciao > > Grazie Per risposta, comunque ho modifcato lo script nell seguente modo, ma > non mi carica l'immagine, anche se quando lo lancio da terminale non mi da > nessuna segnalazione > > ============================================================== > #/usr/bin/env python > > try: > import gtk > import pygtk > pygtk.require('2.0') > except: > import sys > print "Error importing gtk or pygtk" > sys.exit(1) > > > > class Base: > def __init__(self): > self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) > self.window.set_title("my example window") > self.window.set_size_request(500,500) > self.window.set_position(gtk.WIN_POS_CENTER) > self.window.set_icon_from_file("apache.png"); > self.window.connect("destroy",gtk.main_quit) > self.image = gtk.Image() > self.image = > gtk.gdk.pixbuf_new_from_file("../Pictures/porta.jpg") > fixe = gtk.Fixed() > #fixe.put(fixe,100,90) > #fixe.add(fixe) > self.window.show_all() > > def main(self): > gtk.main() > > > if __name__ == "__main__": > base = Base() > base.main() > ============================================================ > > Grazie a tutti > > > Il giorno 11 aprile 2013 12:00, <python-requ...@lists.python.it> ha > scritto: > > > Invia le richieste di iscrizione alla lista Python all'indirizzo > > python@lists.python.it > > > > Per iscriverti o cancellarti attraverso il web, visita > > http://lists.python.it/mailman/listinfo/python > > oppure, via email, manda un messaggio con oggetto `help' all'indirizzo > > python-requ...@lists.python.it > > > > Puoi contattare la persona che gestisce la lista all'indirizzo > > python-ow...@lists.python.it > > > > Se rispondi a questo messaggio, per favore edita la linea dell'oggetto > > in modo che sia più utile di un semplice "Re: Contenuti del digest > > della lista Python..." > > > > > > Argomenti del Giorno: > > > > 1. Gtk Image (emmanuel segura) > > 2. Re: Gtk Image (Gian Mario Tagliaretti) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Wed, 10 Apr 2013 19:03:45 +0200 > > From: emmanuel segura <emi2f...@gmail.com> > > To: python@lists.python.it > > Subject: [Python] Gtk Image > > Message-ID: > > <CAE7pJ3BGzgYAKghiLGD3S= > > vx6abctr7gysnj_igwfny+uan...@mail.gmail.com> > > Content-Type: text/plain; charset="iso-8859-1" > > > > Ciao a tutti > > > > Sto provando a caricare un'immagine usando gtk, ma non riesco perche > ricevo > > un'errore di questo genere > > ================================================================== > > python mywindow.py > > mywindow.py:25: GtkWarning: gtk_widget_set_parent: assertion `widget != > > parent' failed > > fixe.put(fixe,100,90) > > mywindow.py:26: GtkWarning: gtk_widget_set_parent: assertion `widget != > > parent' failed > > fixe.add(fixe) > > ================================================================== > > > > Volevo sapere se sono io che svaglio o c'e qualche problema nella > versione > > di python che sto usando, il mio codice è questo > > > > > > > =========================================================================================== > > #/usr/bin/env python > > > > try: > > import gtk > > import pygtk > > pygtk.require('2.0') > > except: > > import sys > > print "Error importing gtk or pygtk" > > sys.exit(1) > > > > > > > > class Base: > > def __init__(self): > > self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) > > self.window.set_title("my example window") > > self.window.set_size_request(500,500) > > self.window.set_position(gtk.WIN_POS_CENTER) > > self.window.set_icon_from_file("apache.png"); > > self.window.connect("destroy",gtk.main_quit) > > self.image = gtk.Image() > > self.image = > > gtk.gdk.pixbuf_new_from_file("../Pictures/porta.jpg") > > fixe = gtk.Fixed() > > fixe.put(fixe,100,90) > > fixe.add(fixe) > > self.window.show_all() > > > > def main(self): > > gtk.main() > > > > > > if __name__ == "__main__": > > base = Base() > > base.main() > > > > > ================================================================================= > > > > Grazie > > > > -- > > esta es mi vida e me la vivo hasta que dios quiera > > -------------- parte successiva -------------- > > Un allegato HTML è stato rimosso... > > URL: < > > > http://lists.python.it/pipermail/python/attachments/20130410/d87b6dd0/attachment-0001.html > > > > > > > ------------------------------ > > > > Message: 2 > > Date: Wed, 10 Apr 2013 22:33:50 +0200 > > From: Gian Mario Tagliaretti <g.tagliare...@gmail.com> > > To: Discussioni generali sul linguaggio Python > > <python@lists.python.it> > > Subject: Re: [Python] Gtk Image > > Message-ID: > > <CAE= > > wfzu2fumfjvbvcmgfchxdhpxvinpfutgdugftwtfwe0i...@mail.gmail.com> > > Content-Type: text/plain; charset=ISO-8859-1 > > > > On Wed, Apr 10, 2013 at 7:03 PM, emmanuel segura <emi2f...@gmail.com> > > wrote: > > > Ciao a tutti > > > > ciao Emmanuel, > > > > > Sto provando a caricare un'immagine usando gtk, ma non riesco perche > > ricevo > > > un'errore di questo genere > > > > L'errore ti dice esattamente dov'è il problema: > > > > > fixe.put(fixe,100,90) > > > > questa linea, stai mettendo fixe dentro fixe e lui ti dice che "parent > > non è diverso da widget": > > > > > mywindow.py:26: GtkWarning: gtk_widget_set_parent: assertion `widget != > > > parent' failed > > > > ciao > > -- > > Gian Mario Tagliaretti > > GNOME Foundation member > > gia...@gnome.org > > > > > > ------------------------------ > > > > _______________________________________________ > > Python mailing list > > Python@lists.python.it > > http://lists.python.it/mailman/listinfo/python > > > > > > Fine di Digest di Python, Volume 86, Numero 18 > > ********************************************** > > > > > > -- > esta es mi vida e me la vivo hasta que dios quiera > -------------- parte successiva -------------- > Un allegato HTML è stato rimosso... > URL: < > http://lists.python.it/pipermail/python/attachments/20130411/329c69e0/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Thu, 11 Apr 2013 12:49:39 +0200 > From: orciml <orc...@gmail.com> > To: Discussioni generali sul linguaggio Python > <python@lists.python.it> > Subject: Re: [Python] Digest di Python, Volume 86, Numero 18 > Message-ID: <51669543.1000...@gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 11/04/2013 12:34, emmanuel segura wrote: > > Ciao > > > > Grazie Per risposta, comunque ho modifcato lo script nell seguente > > modo, ma non mi carica l'immagine, anche se quando lo lancio da > > terminale non mi da nessuna segnalazione > > > > ============================================================== > > #/usr/bin/env python > > > > try: > > import gtk > > import pygtk > > pygtk.require('2.0') > > except: > > import sys > > print "Error importing gtk or pygtk" > > sys.exit(1) > > > > > > > > class Base: > > def __init__(self): > > self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) > > self.window.set_title("my example window") > > self.window.set_size_request(500,500) > > self.window.set_position(gtk.WIN_POS_CENTER) > > self.window.set_icon_from_file("apache.png"); > > self.window.connect("destroy",gtk.main_quit) > > self.image = gtk.Image() > > qui devi usare l'istanza che hai appena fatto !!! > > self.image.set_from_file("../Pictures/porta.jpg") > > > > self.image = > > gtk.gdk.pixbuf_new_from_file("../Pictures/porta.jpg") > > fixe = gtk.Fixed() > > #fixe.put(fixe,100,90) > > #fixe.add(fixe) > > self.window.show_all() > > > > def main(self): > > gtk.main() > > > > > > if __name__ == "__main__": > > base = Base() > > base.main() > > ciao Loris > > > > ------------------------------ > > Message: 3 > Date: Thu, 11 Apr 2013 12:59:22 +0200 > From: orciml <orc...@gmail.com> > To: Discussioni generali sul linguaggio Python > <python@lists.python.it> > Subject: Re: [Python] Digest di Python, Volume 86, Numero 18 > Message-ID: <5166978a.7060...@gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 11/04/2013 12:34, emmanuel segura wrote: > > Ciao > > > > Grazie Per risposta, comunque ho modifcato lo script nell seguente > > modo, ma non mi carica l'immagine, anche se quando lo lancio da > > terminale non mi da nessuna segnalazione > > > > ============================================================== > > #/usr/bin/env python > > > > try: > > import gtk > > import pygtk > > pygtk.require('2.0') > > except: > > import sys > > print "Error importing gtk or pygtk" > > sys.exit(1) > > > > > > > > class Base: > > def __init__(self): > > self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) > > self.window.set_title("my example window") > > self.window.set_size_request(500,500) > > self.window.set_position(gtk.WIN_POS_CENTER) > > self.window.set_icon_from_file("apache.png"); > > self.window.connect("destroy",gtk.main_quit) > > self.image = gtk.Image() > > qui devi usare l'istanza che hai appena fatto !!! > > self.image.set_from_file("../Pictures/porta.jpg") > > devi anche aggiungere l'oggetto nel contenitore! > > self.window.add(self.image) > > > > > self.image = > > gtk.gdk.pixbuf_new_from_file("../Pictures/porta.jpg") > > fixe = gtk.Fixed() > > #fixe.put(fixe,100,90) > > #fixe.add(fixe) > > self.window.show_all() > > > > def main(self): > > gtk.main() > > > > > > if __name__ == "__main__": > > base = Base() > > base.main() > > ciao Loris > > > > ------------------------------ > > Message: 4 > Date: Thu, 11 Apr 2013 13:03:45 +0200 > From: orciml <orc...@gmail.com> > To: Discussioni generali sul linguaggio Python > <python@lists.python.it> > Subject: Re: [Python] Digest di Python, Volume 86, Numero 18 > Message-ID: <51669891.5080...@gmail.com> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 11/04/2013 12:34, emmanuel segura wrote: > > Ciao > > > > Grazie Per risposta, comunque ho modifcato lo script nell seguente > > modo, ma non mi carica l'immagine, anche se quando lo lancio da > > terminale non mi da nessuna segnalazione > > > > se ti puo' interessare avevo fatto delle slide che sono presenti in: > > http://www.slideshare.net/orcim/py05-gtk > > ciao! > > > ------------------------------ > > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python > > > Fine di Digest di Python, Volume 86, Numero 19 > ********************************************** > -- esta es mi vida e me la vivo hasta que dios quiera
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python