Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I start to develop a test application to experiment button clicks, window's title change and other widgets use.

on button objects it's easy to make event "clicked" to work, in to window class and declare on_button_clicked(...) and works, no more its needed.

def on_button1_clicked(self, button):
    print "Clicked Exit"
    Gtk.main_quit()

but whit the Entry object i try to make some similar to the event "changed" whitout success. Do any one have a clue about how to handle events on this an other type of object (Entry, Comoboxtext, Radiobutton, etc) on Python/Quicly

I try some like this but didn't work

def on_entry1_changed(self, entry):
    self.ui.prototipo1_window.set_title(self.ui.entry1.get_text())

Any one? thank you a lot by your help.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

If you are getting started with PyGtk and Quickly, I would definitely recommend this tutorial, it has helped me very much.

Are you using Glade for your gui designer? If you arn't, you would have to connect the signals manually by doing something like this:

from gi.repository import Gtk

class Handlers:
    def on_button1_clicked(self,builder):
        print "Clicked Exit"
        Gtk.main_quit()

    def on_entry1_changed(self,builder):
        entry = self.builder.get_object("entry1")
        self.builder.get_object("TestWindow").set_title(entry.get_text())

builder = Gtk.Builder()
builder.add_from_file("example.ui")
builder.connect_signals(Handlers())
window = builder.get_object("TestWindow")
window.show()
Gtk.main()

More about manually connecting handlers like this is found here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.