How to create a modal dialog without a title icon in PyGTK?

Using PyGTK on Windows, I want to create a modal dialog box that does not have an icon in the title bar, in the Microsoft manual for dialog boxes . The guidelines indicate that most dialog boxes should not have title icons (except for dialog boxes that implement the main window or utility and are displayed on the taskbar).

The absence of a title bar icon is different from a blank icon because the dialog title is completely justified on the left and there is no room for left-clicking on the window context menu (you must right-click the title bar).

I thought the following code would work:

import gtk win = gtk.Window() win.set_icon(None) win.connect("delete-event",gtk.main_quit) dia = gtk.Dialog(parent=win, flags=gtk.DIALOG_MODAL) dia.set_skip_taskbar_hint(True) dia.set_icon(None) win.show() dia.show() gtk.main() 

The dialog displayed by this code is modal and does not appear on the taskbar. However, it still has an icon in the title bar, which I don't want. I know that Windows can display a dialog without an icon, because most error messages in the Windows shell do not have them.

I also tested the above code on GNU / Linux, and it behaves the same ... a modal dialog box without a hint on the taskbar, but it still has a title icon.

I would be happy with the hack as an answer for now, but I intend to file an error message for GTK / PyGTK if there is no clean way to do this.

+4
source share
1 answer

try it

 window = gtk.Window() dialog = gtk.Dialog() dialog.set_modal(True) dialog.set_transient_for(window) dialog.set_decorated(False) window.show() dialog.show() gtk.main() 
+3
source

Source: https://habr.com/ru/post/1344326/


All Articles