Progress window

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  07 July 2013
Progress window

Hi, I'm wanting to try place a progress window for some code I've done, but I'm struggling to get it working inside the code.

Here's a test bit of code I was trying it with, if anyone could get it so it'll run through the code and update for each 1% completion, I'd be really grateful, as all I can manage to do is freeze up maya :P

Code minus the progress window:
import random as rd
 import pymel.core as py
 from time import time
 def stuff_in_the_place_of_the_main_code():
 	num = 0
 	while num < 500000:
 		a = rd.uniform(rd.uniform(rd.uniform(2,-75),rd.uniform(26,848)),rd.uniform(rd.uniform(rd.u  niform(-5240,436.2),65),-26.403))
 		num += 1
 def buttonPressed():
 	print "done"
 win = py.window(title="test",  mxb=False, s=False)
 win_layout = py.rowColumnLayout(numberOfColumns=4 )
 py.button( label="button", command = py.Callback( buttonPressed ) )

Progress window code (got from the pymel commands site):

 amount = 0
 py.progressWindow(	title='Doing Nothing',
 										status='Sleeping: 0%',
 										isInterruptable=True )
 while True :
 		# Check if the dialog has been cancelled
 		if py.progressWindow( query=True, isCancelled=True ) :
 		# Check if end condition has been reached
 		if py.progressWindow( query=True, progress=True ) == 500 :
 		amount += 1
 		py.progressWindow( edit=True, progress=amount, status=('Sleeping: ' + `amount` + '%' ) )
 		py.pause( seconds=1.0 )

Before you suggest it, I thought about replacing the pause command with the function, but I need it to run within the code

  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:51 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.