looks really good. the only thing i think i would change would be to  
make the window name constant.  as it is, it seems that under certain  
circumstances the self.myWin attribute might not exist when the window  
actually does.


class myUI(object):
    winName = 'myUI'
    def __init__(self):

        try:
            deleteUI(self.winName)
        except:
            pass

        self.myWin = window(self. winName)
        columnLayout()

        for i in range(5):
            button('b'+str(i),l='button_'+str(i), c = Callback
(self.checkButton,i))
        self.myWin.show()

    def checkButton(self,id):
        print button('b'+str(id),query=True,label=True)


-chad



On Mar 31, 2009, at 4:51 AM, marcin wrote:

>
> I've question about creating dynamic ui in pymel. Is there a way to
> make
> this code more pythonic in pymel ?
>
> from pymel import *
>
> class myUI(object):
>    def __init__(self):
>
>        try:
>            deleteUI(self.myWin)
>        except:
>            pass
>
>        self.myWin = window()
>        columnLayout()
>
>        for i in range(5):
>            button('b'+str(i),l='button_'+str(i), c = Callback
> (self.checkButton,i))
>        self.myWin.show()
>
>    def checkButton(self,id):
>        print button('b'+str(id),query=True,label=True)
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to