Reputation: 978
some times I need to insert new response (button) to MessageDialog
but I don't know how I can do this. for example msg_dialog.insert_response(Gtk.STOCK_OK, Gtk.ResponseType.OK, 2)
Thanks
Upvotes: 3
Views: 791
Reputation: 4104
The method you are looking for is Gtk.Dialog.add_button:
Adds a button with the given text and sets things up so that clicking the button will emit the Gtk.Dialog ::response signal with the given response_id. The button is appended to the end of the dialog’s action area. The button widget is returned, but usually you don’t need it.
If you want to add several buttons, then you can use Gtk.Dialog.add_buttons:
The add_buttons() method adds several buttons to the Gtk.Dialog using the button data passed as arguments to the method. This method is the same as calling the Gtk.Dialog.add_button() repeatedly.
The button data pairs - button text (or stock ID) and a response ID integer are passed individually. For example:
dialog.add_buttons(Gtk.STOCK_OPEN, 42, "Close", Gtk.ResponseType.CLOSE)
will add “Open” and “Close” buttons to dialog.
Upvotes: 2