# Dialog (Python)

Marta Maria Casetti
mmcasetti@gmail.com 2012
A popup window

# Dialog

A dialog with the response signal connected to a callback function.

# Code used to generate this example

# Useful methods for a Dialog widget

In line 16 the signal `"clicked"` is connected to the callback function `on_button_click()` using `widget.connect(signal, callback function)`. See for a more detailed explanation.

Instead of `set_modal(True)` we could have `set_modal(False)` followed by `set_destroy_with_parent(True)` that would destroy the dialog window if the main window is closed.

`add_button(button_text="The Answer", response_id=42)`, where `42` is any integer, is an alternative to `add_button(button_text="text", response_id=Gtk.ResponseType.RESPONSE)`, where `RESPONSE` could be one of `OK, CANCEL, CLOSE, YES, NO, APPLY, HELP`, which in turn correspond to the integers `-5, -6,..., -11`.

# API References

In this sample we used the following:

GtkDialog

GtkWindow