Msgbox python

Could someone show me an example of msgbox for python macro in CALC

I tried this example, but it didn’t work:
https://help.libreoffice.org/6.3/en-US/text/sbasic/python/python_screen.html?DbPAR=BASIC#N0433

Complement2:
Doubt resolved
I will leave here a simple example code as a reference for other user searches

MSG_BUTTONS
https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt_1_1MessageBoxButtons.html

type_msg:
https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt.html#ad249d76933bdf54c35f4eaf51a5b7965

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uno
from com.sun.star.awt import MessageBoxButtons as MSG_BUTTONS

def msgbox(message, title='LibreOffice', buttons=MSG_BUTTONS.BUTTONS_OK, type_msg='infobox'):
    """ Create message box
        MSG_BUTTONS => BUTTONS_OK = 1, BUTTONS_OK_CANCEL = 2, BUTTONS_YES_NO = 3, BUTTONS_YES_NO_CANCEL = 4, BUTTONS_RETRY_CANCEL = 5, BUTTONS_ABORT_IGNORE_RETRY = 6
        https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt_1_1MessageBoxButtons.html

        type_msg => MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
        https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1awt.html#ad249d76933bdf54c35f4eaf51a5b7965
    """
    CTX = XSCRIPTCONTEXT.getComponentContext()
    toolkit = CTX.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
    parent = toolkit.getDesktopWindow()
    mb = toolkit.createMessageBox(parent, type_msg, buttons, title, str(message))
    return mb.execute()

def test(*args):
    result = msgbox('Hiiiiiiii', 'my Title', 3, 'QUERYBOX')
    print(result)

    if result == 2:
        print('Hello!')
    else:
        print('World!')

You can read:

The Alternative Python Script Organizer (APSO) extension offers a msgbox() function out of its apso_utils module.

You need install it, and maybe copy the module.

I you only need a simple msgbox, look:

https://wiki.documentfoundation.org/Macros/Python_Guide/Useful_functions

Thank you so much, that’s what you needed.

Hi

Input/Output to Screen with Python provides extra examples.