Python window doesn't collapse properly

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Search this Thread Display Modes
  2 Weeks Ago
Python window doesn't collapse properly

Hi; I know this is a problem many people have but I have never been able to find a way to fix it.
To summarize, when running a Python script in Maya, collapsing a tab or frame layout does not collapse the window to fit the newly resized frame.

The fix that I tried was the following...
Quote: cmds.frameLayout( label='frame1', cll=True, cl=True, ec = partial (collapsedFrame, tab1 ), cc= partial (collapsedFrame, tab1 ), w=500, bgc= bgDkgray, parent=tab1)
Quote: def collapsedFrame( name, *args ): winHeight = 0 frameHeight = 0 # iterate through all children of the main layout for child in cmds.rowColumnLayout(name, q=1, ca=1): # for each child, get it's type, then use that run an eval command to get that ui item's height and add it to the height variable frameHeight = eval('cmds.' + cmds.objectTypeUI(child) + '("' + child + '", q=1, h=1)') winHeight += frameHeight # set the window height with the gathered height values print "cycled: " + str(frameHeight) print str(winHeight) cmds.window('newWindow', e=1, h=winHeight)
However, this is where I noticed an issue that throws a wrench in this solution. By looking at the print statements, I confirmed that the script, collapsedFrame, gets run before the frame actually gets closed, instead of after. The problem with this is that the math just doesn't add up as expected. Instead of querying the heights of the frames after they've been collapsed, the program queries the heights of the frames before they get collapsed.
Does anyone have a solution to this?
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:11 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.