Question

I have a button in my code:

self.add_bt = Gtk.Button()
self.add_bt.set_label(_("Choose from computer"))


vbox.pack_start(self.add_bt, False, False, 0)

I want to include FileChooser function on clicking this button.

dlg = Gtk.FileChooserDialog()
dlg.show()

What I am trying to do is, on clicking the button labelled "Choose from computer" I want the browse window to open. Then get the added file included in place of current image.

Was it helpful?

Solution

Do you mean something like:

self.add_bt.connect("clicked", self.on_add_bt_clicked)

def on_add_bt_clicked(self, button):
    dlg = Gtk.FileChooserDialog()
    dlg.show()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top