Source code for tesfdmtools.utils.widgets.msg

#!/usr/bin/env python3
"""
.. module:: msg
   :synopsis: Show a message in a window
.. moduleauthor:: Cor de Vries <c.p.de.vries@sron.nl>         
"""

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

[docs]def msg(msg,parent=None,title=None): ''' Show a message in a window. Uses the Gtk.MessageDialog window. Args: * `msg` = The message text to be shown Kwargs: * `title` = Title for the message * `parent` = Parent window if it exists ''' dialog=Gtk.MessageDialog( parent=None,type=Gtk.MessageType.INFO,buttons=Gtk.ButtonsType.OK,message_format=msg) if parent is not None: dialog.set_transient_for(parent) if title is not None: dialog.set_title(title) dialog.show() dialog.run() dialog.destroy() return None