Have a look at the "command" parameter as well as the usage example at the
bottom of this link
http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/button.html#flagcommand

The missing bit from this example however is how to modify your scroll
layout from the callback. What you should do is same the same of the scroll
control that is returned when you first create it. You need that reference
to be able to either edit the scrollLayout later in the button callback or
to set it as the parent when adding more child UI controls. If you are
writing your code as a class, this should be trivial because you can store
the same of the scrollLayout as a member variable and read it later in the
callback. If you are only using functions then you may need to capture the
name into a function closure, either by defining your callback function
right there in the same function as your layout, or looking at lambda or
functools.partial
Either way, I would recommend sticking to the approach of passing a
callback function as opposed to the string form that Mel uses.

Justin

On Sat, 24 Sep 2016, 5:11 AM I73 <[email protected]> wrote:

> Is it possible to populate a scroll list after the user preforms an
> action?
>
>
>              cmds.button('Fill Scroll layout', someFunctionToFillLayout)
>              cmds.scrollLayout(...)
>         #Want to fill the scroll layout with a list of verts after the
> user clicks a button
> for vert in verts:
> cmds.text(vert)
>      cmds.setParent('..')
>
> How can I achieve appending text inside the scroll layout once an
>
> --
> 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/cd499b43-b31a-4ac2-bb75-4f179cab4a17%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/cd499b43-b31a-4ac2-bb75-4f179cab4a17%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA0ySWkHnvri6e4sJjuVn95xSufv2b-rQYgN_L4oTAf%2BSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to