Justin,

Thx for the help. it worked.

sorry for the delay reply.

On Friday, October 5, 2012 10:46:30 AM UTC+5:30, Justin Israel wrote:
>
> The MainUi object is global to the scope of that module. Not to the entire 
> Maya python environment. You would need to have the executeDeferred 
> actually create and assign a variable referring to it. 
> A larger problem with your code is that you are not using a class 
> structure and just have functions operating on a global variable. 
> You should have a class that can assemble itself and be shown. That way 
> the executeDeferred call can create an instance of it, and show it. And you 
> will have access to that instance from the Script Editor
> Avoid the use of globals in your design if you can. 
>
> A quick fix is to have main() return the instance of MainUi so you can 
> assign it to the result in:
> executeDeferred("import theModule ; MainUi = theModule.main()")
>
> On Oct 4, 2012, at 9:21 PM, PBLN RAO <[email protected] <javascript:>> 
> wrote:
>
>
> Attached required files for your reference.
>
> When maya loads its opening the window.
>
> So if i use below command to update a label on that window i get the error
>
> MainUi.lbl_Login_ID.setText(UserLogin)
>
> # Error: NameError: name 'MainUi' is not defined #
>
> Where this MainUi i used in ShowTimePro main() function. this is a 
> variable that has the GUI (Interface()) Instance.
>
>
> On Thursday, October 4, 2012 7:23:35 PM UTC+5:30, Justin Israel wrote:
>>
>> Can you show the code snippet you are using to start the window in your 
>> userSetup?  You are probably just creating a local variable whose reference 
>> gets lost after the window is created. 
>>
>> On Oct 4, 2012, at 6:07 AM, PBLN RAO <[email protected]> wrote:
>>
>> Hi,
>>
>> I created a application which loads when maya starts up. For this we 
>> added a line in userSetup.py
>>
>> Now if i want to update a label in that window i get an error label not 
>> found.
>>
>> In main function we created an instance of the Ui say (testUI).
>>
>> if i use testUi.label.setText('Test Update') i variable not found/defined 
>> error.
>>
>> but if the same python script is copied and executed in script editor and 
>> run i can able to update the label. its not happening when loaded at maya 
>> startup from userSetup.
>>
>> any suggestions....? 
>>
>>  -- 
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings: 
>> http://groups.google.com/group/python_inside_maya/subscribe
>>
>>  -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe
>
> <ShowTimePro.py>
>
> <userSetup.py>
>
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to