Hi Rob, There's been some mentions of this in other threads, but it deserves some further spotlight.
- Rapid GUI Programming with Python and Qt <http://www.amazon.co.uk/Rapid-GUI-Programming-Python-Development/dp/0132354187> It goes well beyond the basic examples and should provide you with a solid foothold on how to get started with PyQt/PySide. Best, Marcus On 3 November 2014 13:22, rob lee Jones <[email protected]> wrote: > Hi there, > This is a question to the community at large for some fastrack help in > converting a simple tutorial.exercise 'wall builder' script written in > python using Maya's native UI functionality to one that deploys Pyside > instead. > I'm aware that there is a growing repository of intro to PySide in Maya > type tutorials...but they don't seem to go much beyond the very first > 'hello world' button push. I'm happy to stand corrected on this observation > by the way. > > So here's a little exercise I would like to convert as a way of > understanding how user input can be captured and used inside a python > function. > If anyone can knock up a solution which I imagine would be real quick if > you are already fluent with pyQT/PySide it would be most appreciated. > Basically the script below *accepts two integers from the User* (width, > height of wall to be built) and when the 'create wall' b*utton is pushed > these values are then passed to a python function that uses them *to > generate the wall of the required dimensions. > I've started to look through the docs but was hoping to get a heads up > from anyone that is willing to shed light on how to do this in PySide. > > Here's the original python script with native Maya UI functionality to be > converted to using PySide instead.... > > > import maya.cmds as cmds > if cmds.window("brickGen", exists=True): > cmds.deleteUI( "brickGen") > > window = cmds.window("brickGen", title = "Brick Wall Generator") > > cmds.columnLayout() > *cmds.intField("wallHeight", minValue=1, maxValue=30, value=1) * > *cmds.intField("wallLength", minValue=1, maxValue=30, value=1) * > *cmds.button(label="create wall", command="brickGen()")* > > > def brickGen(): > # question ....how to do the next two lines or equivalent in > PySide..... > * col = cmds.intField("wallHeight", q=True, value=True)* > * row = cmds.intField("wallLength" , q=True, value=True)* > i=0 > j=0 > offset=-1.5 > brickHeight=1 > > while i < col: > h= brickHeight*i > if (i%2==0): > print 'even brick' > while j < row: > cmds.polyCube(w=1,h=1,d=3) > cmds.move(3*j, z=True, r=True) > cmds.move(h, y=True, r=True) > j+=1 > else: > print 'odd brick' > while j < row: > cmds.polyCube(w=1,h=1,d=3) > cmds.move(3*j, z=True, r=True) > cmds.move(h, y=True, r=True) > cmds.move(offset,z=True,r=True) > j+=1 > > i+=1 > j=0 > > cmds.showWindow() > > > Thanks in advance to anyone for any help with this request. > Regards > Rob. > > -- > 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/9ca1d797-894a-472f-97ac-4fa84cc24b56%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/9ca1d797-894a-472f-97ac-4fa84cc24b56%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- 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/CAFRtmOBkLF9vfZBVFvP%3DZBAOg_EdtM22iQJAvpK%3DBDMLoWdz0A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
