How do I force a window to open to a specific size or location?
The ‘-width ’, ‘-height ’, ‘-topEdge ’ and ‘-leftEdge ’
parameters used with a "window" command are used only when the window is opened for the first time. After
that Maya uses the last-used dimensions stored in your user preferences.
All is not lost, however. You can work around this in one of two ways:
- Disallow resizing of the window by using the "-sizeable false" flag. Of course, this
affects only size (‘
-width ’ and ‘-height ’ parameters), and not position.
window -sizeable false -width 100 -height 100 myWindow;
columnLayout;
setParent ..;
showWindow myWindow;
- Tweak the window back to its desired dimensions after it is created.
window myWindow;
columnLayout;
setParent ..;
window -e -width 100 -height 100 myWindow;
showWindow myWindow;
Disclaimer: You should only force these parameters when it is crucial to do so, or when it
markedly improves workflow. Circumventing user preferences is prone to annoy the users
of your tools.
|