Il 11/05/2012 20:37, Gian Mario Tagliaretti ha scritto:
2012/5/11 Matteo Perini<perini.mat...@gmail.com>:
Ciao a tutti,
ciao Matteo,
posta un esempio completo anche se non funzionante, è più facile
aiutarti, adesso sparo e vediamo se prendo il piccione...
La textbox:
self.entry1 = gtk.Entry()
self.num_grab=self.entry1.get_text()
Il button:
self.button1 = gtk.Button("Grab Image")
self.button1.connect("clicked", self.get_image)
Nella class Window ho anche la funzione che voglio richiamare col button:
def get_image(self,widget):
self.num_grab= Window.win_take_pictures
print self.num_grab
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class EntryExample:
def press_callback(self, widget, entry):
entry_text = entry.get_text()
print "Entry contents: %s\n" % entry_text
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_size_request(200, 100)
window.set_title("Entry Example")
window.connect("delete_event", lambda w,e: gtk.main_quit())
vbox = gtk.VBox(False, 0)
window.add(vbox)
vbox.show()
entry = gtk.Entry()
entry.connect("activate", self.press_callback, entry)
entry.set_text("stampami")
vbox.pack_start(entry, True, True, 0)
entry.show()
button = gtk.Button(stock=gtk.STOCK_EXECUTE)
button.connect("clicked", self.press_callback, entry)
vbox.pack_start(button, True, True, 0)
button.set_flags(gtk.CAN_DEFAULT)
button.grab_default()
button.show()
window.show()
def main():
gtk.main()
return 0
if __name__ == "__main__":
EntryExample()
main()
ciao
Grazie mille.... oggi al lavoro ho risolto vedendo proprio questo
esempio (scusatemi ma mi sono dimenticato di aggiornarvi).
In effetti la soluzione è di passare l'oggetto "entry" alla nuova funzione.
Dovete scusare la domanda banale ma sto imparando e alcune cose non mi
sono ancora familiari.
Buona serata
Matteo P
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python