On Sat, Nov 23, 2019 at 2:44 PM likage <[email protected]> wrote:

> Hi all, I am trying to 'scale' down the gui so as to reduce the spacing
> between my widgets whenever the tool is called.
>
> I tried using `setFixedSize`, while it does seems to scales down to what I
> had wanted, but the window, see attached, stays as it is and it is not
> being scaled down with it.
> As such, this has results in extra blank unnecessary spaces.
>
> [image: gui_resize_issue.png]
>
>
> My GUI comes from using qt-designer and the following is a small code
> portion of the GUI initialization:
> class MyTool(MayaQWidgetDockableMixin, QtWidgets.QWidget):
>     def __init__(self, parent=None, dockable=True):
>         super(MyTool, self).__init__(parent=parent)
>
>         # self.ui comes from a qt-designer file
>         self.ui = Ui_MyTestWidget()
>         self.ui.setupUi(self)
>
>         # set other methods/ connections etc...
>         ...
>         ...
>
>         # Attempting to 'scale' down the widgets, seems to work but not
> for the window
>         # using self.adjustSize() does not seems to be doing anything
>         self.setFixedSize(890, 505)
>
>
> This is how I called upon my GUI:
> import main_tool
> app = main_tool.MyTool()
>
> Appreciate for any insights!
>

Fixing your layout size depends on a few more specifics of how you are
running your tool.
First off, using setFixedSize() is going to do exactly what it says, which
is to lock your widget to one size. This means that the parent widget now
has all that empty space when it resizes large than the fixed size of that
child widget. You obviously don't want that effect.
In your screenshot, are we looking at the result of a floating standalone
window, or is this the widget docked into Maya's layout? If its docked into
Maya's layout, then shouldn't it expand to the size of the dock widget? And
if its a standalone window, shouldn't it expand to the bounds of the parent
window? It isn't clear to me what you want to do with that extra space of
the container.


> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/11579ffc-d7e2-4716-a70b-80e6dd6457a6%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/11579ffc-d7e2-4716-a70b-80e6dd6457a6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA12N%3DLkP-QDJu5gT1vpycksM7L885Q8kr2PVb-6_bh%2BuA%40mail.gmail.com.

Reply via email to