macOS MessageBox in python thread

The following script works on windows but not on macOS. Is there some workaround?


import rhinoscriptsyntax as rs

rs.MessageBox("main_thread")

import thread
def hello():
    rs.MessageBox("thread")
thread.start_new_thread(hello, ())

Hi Bar,

I can’t answer your question, but I have one for you, what did you need this for? I’m curious as to what advantage is to having these blocking (can’t continue in Rhino until you close them) UI elements on a separate thread?

Cheers

DK

actually I have a web service which has to calculate stuff up to an hour. Since I want to generate the results in Rhino as soon as the service is finished I have a waiting thread. Iff something unexpected happens in the service I want to inform the user with a MessageBox.

The answer is

def show_message(what):
    rs.MessageBox(what)


def secure_message(what):
    Rhino.RhinoApp.InvokeOnUiThread(Action[str](show_message), what)