Claudiu
Claudiu

Reputation: 229361

In GTK, how do I make a window unable to be closed?

For example, graying out the "X" on windows systems.

Upvotes: 4

Views: 838

Answers (2)

markuz
markuz

Reputation: 919

If Gtk can't convince the window manager you can always connect the "delete-event" signal and return True from the callback. Doing this Gtk assumes that the callback handle that signal and does nothing.

import gtk

window = gtk.Window()
window.connect('delete-event',lambda widget, event: True)

Upvotes: 5

Claudiu
Claudiu

Reputation: 229361

Just call the set_deletable with False on the window in question. It will work as long as GTK can convince the window manager to make the window unclosable.

Upvotes: 4

Related Questions