Current glyph window size and position

  • Hello,

    I want to make my script window appear in the center of the current active window. I searched in the docs but didn't found anything useful. Is there any way to do this?


  • admin


    I don't fully understand why but here is a script that is changing the size and position of the current window to the previous current window

    from AppKit import NSApp
    # get all ordered windows
    windows = NSApp().orderedWindows()
    # get the size of the window
    (x, y), (w, h) =  windows[1].frame()
    # set the size of the window
    windows[0].setFrame_display_animate_(((x, y), (w, h)), True, False)

    good luck!