Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Proper Parenting for ETO forms in Rhino6 (Python)?

$
0
0

Two questions:

  1. Given MainWindowForDocument doesn’t exist in Rhino6, what is the most cross-platform-friendly way to parent my ETO forms? This is what I’m doing at the bottom of all my ETO forms’ code currently. And it seems to work on Windows for Rhino 6, 7, and 8, but I don’t have a Mac to test it on.
if __name__ == '__main__':        
    dialog = MyDialog()
    if rs.ExeVersion() > 6:
        parent = Rhino.UI.RhinoEtoApp.MainWindowForDocument(sc.doc)
    else:
        parent = Rhino.UI.RhinoEtoApp.MainWindow
    Rhino.UI.EtoExtensions.ShowSemiModal(dialog, sc.doc, parent)

I just want to know if there is a better way to do this…especially for Rhino6.

  1. The new ETO documentation uses both sc.doc and __rhino_doc__ as an argument for MainWindowForDocument in the various examples and I wondered if there was any difference between the two or is that two ways to reference the same object?

(Also, I noticed none of the new ETO documentation uses the if __name__=="__main__": Is it better to not use that or does it make no difference?)

Any thoughts, @CallumSykes?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles