Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Spyder Python Message Box With Icon

1 REPLY 1
Reply
Message 1 of 2
isocam
628 Views, 1 Reply

Spyder Python Message Box With Icon

Can anybody help?

 

Can anybody please tell me is Spyder Python messagebox can be displayed with an icon as well, similar to the VB.net

MsgBox(“Hello WORLD”, MsgBoxStyle.Information, “this is a msgbox”)

 

Many thanks in advance

 

Darren

1 REPLY 1
Message 2 of 2
JeromeBriot
in reply to: isocam

Hello Darren,

use the messageBox method of the UserInterface object with its second calling form:

returnValue = userInterface_var.messageBox(text, title, buttons, icon)


Then see these enumerations :


Now your example translated in Python:

import adsk.core, traceback

def run(context):

    ui = None

    try:

        app = adsk.core.Application.get()
        ui  = app.userInterface

        ui.messageBox('Hello WORLD', 'this is a msgbox', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.InformationIconType)

        # Or shorter:
        #  ui.messageBox('Hello WORLD', 'this is a msgbox', 0, 2)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))



Hope it helps

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report