Auto-close message box

(Verina Cristie) #1

Hi, i’m writing a plugin to send data to server from Grasshopper.
I’d like to pop up a message box upon sending, which is done using:
Rhino.UI.Dialogs.ShowMessageBox

Is there a way to trigger close this message box from my code? I will check when data is sent and would like to automatically close the message box created.

0 Likes

#2

Not sure if Rhino.UI has a similar class but in Eto.Forms you can instantiate a Form and make your own pop-up. Here I show you a pattern you may use

import Eto.Forms as forms
import Eto.Drawing as drawing
import time

dialog = forms.Form()
dialog.Size = drawing.Size(400,400)
layout = forms.DynamicLayout()
layout.AddSeparateRow(forms.Label(Text='waiting for 3 secs'))
dialog.Content = layout
if x:
    dialog.Show()
    time.sleep(3)
    dialog.Close()

I put this in a GhPython component so you can feed a button into an x input
image

2 Likes

(Verina Cristie) #3

thank you for the eto form suggestion! will try :slight_smile:

0 Likes