ikreb
ikreb

Reputation: 2775

[Python GTK+ 3]: MessageDialog: Set OK-button settings

I want that the button is disabled under some conditions with set_sensitive(False).

The problem is that I don't know how I could call the ok or cancel button at the MessageDialog.

dialog_window = Gtk.MessageDialog(parent=None,
                                  flags=Gtk.DialogFlags.MODAL,
                                  type=Gtk.MessageType.QUESTION,
                                  buttons=Gtk.ButtonsType.OK_CANCEL,
                                  message_format="Edit username.")

I want something like ok_button.set_sensitive(False).

Upvotes: 0

Views: 249

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14587

Something like

dialog.set_response_sensitive(Gtk.ResponseType.OK, False);

should set the sensitivity on all buttons with ResponseType OK.

Upvotes: 1

Related Questions