PDA

View Full Version : window -widthHeight flag ignored?


Freshfromthegrave
02-18-2011, 12:32 PM
hey guys i keep having this problem with my windows, it seems to ignore the -wh flag on my windows and just creates a huge window instead. that window can be resized and then each time i run it it's fine but that's not ideal. the -rtf flag works and is better but sometimes it's too close to some controls and too far from others.

so this line: window -t "SMO_RandomSelect" -wh 400 400 -s false SMO_RandomSelectWindow;

would do the exact same thing as:

window -t "SMO_RandomSelect" -rtf true -s false SMO_RandomSelectWindow;

without the sizable flag the -wh is still ignored but with -rtf it reacts the same as with it on.

am i doing something wrong with this line?

mlefevre
02-18-2011, 12:39 PM
hey,

i haven't got access to maya at the mo, but you may need to delete the window prefs first.
search the command docs for windowPrefs or something of that nature.
good luck :)

Freshfromthegrave
02-18-2011, 12:44 PM
thanks matt will take a look for it :)

NaughtyNathan
02-18-2011, 12:46 PM
Matt has got it, and this has come up before, but to elaborate a bit more: Maya stores all your window sizes and locations in it's prefs (you can disable this in the settings/preferences) which means that as soon as you create a newly named window in code it's position and size (after you've closed it for the first time!) is saved for next time. As Matt says, you can delete it's details from the prefs, but take a look at this post:

http://forums.cgsociety.org/showthread.php?f=89&t=885834&highlight=window+size

:nathaN

Freshfromthegrave
02-18-2011, 01:03 PM
hey nathan :) yeah matt was right it does work now ^^ but strangely enough if i use the -s false flag to lock the size down it goes back to it's old ways again =\ i can deal with a resize-able window but a locked down one seems nicer

edit: but i think this will be fine actually :) thanks guys! appreciate it as always!

NateH
02-18-2011, 07:06 PM
Just a heads up, if you show the window, and then edit it's width/height like below it will always set the initial size to the one you want (While still being resizeable) I find this to be easier than killing the prefs personally.

import maya.cmds as cmds
if cmds.widnow('testWindow', ex=True):
cmds.deleteUI('testWindow')
cmds.window('testWindow', t='test')
cmds.showWindow()
#Edit the size now that it's shown, this is different than setting the "Initial" size when creating the window
cmds.window('testWindow', e=True, wh=(400, 400))

NaughtyNathan
02-18-2011, 09:22 PM
is there any point making a window resizable if it gets reset to the same original size every time the user opened it? that would annoy the hell out of me if I'd set it to my preferred desired size..! :D

NateH
02-19-2011, 12:19 AM
is there any point making a window resizable if it gets reset to the same original size every time the user opened it? that would annoy the hell out of me if I'd set it to my preferred desired size..! :D
Haha, yeah it can be annoying if used incorrectly.

EightBit
02-21-2011, 04:38 AM
I use this in all my UI scripts to clear the windowPrefs. Set 'testing' to suit the needs of the moment: # CREATE WINDOW
if cmds.window(winName, q=True, ex=True):
cmds.deleteUI(winName)
testing = 0
# Delete windowPrefs when testing, might generate error if existence is not tested for also:
if (testing and cmds.windowPref(winName, exists=True)):
cmds.windowPref( winName, remove=True )

thisWin = cmds.window(winName, t= winName, w = winWidth, h = winWidth)

CGTalk Moderation
02-21-2011, 04:38 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.