Right! I didn't think that since I wasn't using a layout, I would end up with both of them sitting on top of each other. (I should have tried to draw one, and then the other to verify that they both were getting properly parented).
Thanks again for coming to the rescue Justin! -- David Martinez - Technical Animator Email: [email protected] Website: http://www.elusiveideas.com On Sun, Mar 16, 2014 at 6:47 PM, Justin Israel <[email protected]>wrote: > Hey David, > > Actually your parenting should be working just fine either way. The > problem you are seeing is that because the widgets are not in any kind of > layout, they end up being positioned at (0,0) of their parent... on top of > each other. The last one you created will be on top. > > Try adding this line to the end of your code, and you should end up seeing > both of them: > > button2.move(0, button2.height()) > > If you want to see the effect of a layout, you can add this to the end of > your code: > > vlayout = QtGui.QVBoxLayout(widget) > vlayout.addWidget(button) > vlayout.addWidget(button2) > > -- justin > > > > > On Mon, Mar 17, 2014 at 6:06 AM, David Martinez < > [email protected]> wrote: > >> Hello there, >> >> I'm watching *Justin Israel'*s video on PyQT and I have the following >> question: >> >> Why is it that if a 'QPushbutton' is created with a widget as a parent it >> works fine but if I create the button first and then parent it using the >> 'setParent' method of a 'QObject', it doesn't? >> >> Here is the code that I'm executing with iPython (where I already have an >> event loop working) >> >> https://gist.github.com/davidmartinezanim/9586313 >> >> I'm just trying to understand the specifics of why that doesn't work. >> I've tried printing the parent of both buttons and both of them are >> children of the widget. >> >> >> -- >> David Martinez - Technical Animator >> >> Email: [email protected] >> Website: http://www.elusiveideas.com >> >> >> -- >> 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/CAMLeNpzu2%2BPOs5pZypwGuBvkXX_zb7w0cp7nvsyV8tDCcj8eVw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAMLeNpzu2%2BPOs5pZypwGuBvkXX_zb7w0cp7nvsyV8tDCcj8eVw%40mail.gmail.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/CAPGFgA3n6%3DF33hWMH3-jhEnARVoNW0q2CZEYAetarS4x9pNK3w%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3n6%3DF33hWMH3-jhEnARVoNW0q2CZEYAetarS4x9pNK3w%40mail.gmail.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/CAMLeNpxRViVLzXmrcjoGBmMF5iOZnDyh5Jx_AWVfDRBmx67GKg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
