Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does anyone know how to fix this problem? I want some like Image one, which is like has a progress bar at the top of the two buttons, but when I run the code it will look like Image two.
Here is the code:
import maya.cmds as cmds
import math
def windowUI(*args):
if cmds.window("progress_bar", exists=True):
cmds.deleteUI("progress_bar")
bar_window = cmds.window("progress_bar", title="Progress Bar", sizeable=False)
cmds.columnLayout()
cmds.separator(h=10, st='in')
#progressControl = cmds.progressBar(maxValue=100, width=300)
#cmds.separator(h=5, st='in')
cmds.rowColumnLayout(nc=2, cw=[4,2])
#Buttons
cmds.button("start_button", label="Start", w=149, command=start_part)
cmds.button("close_button", label="Close", w=149, command=close_part)
cmds.showWindow(bar_window)
def start_part(*args):
progressControl = cmds.progressBar(maxValue=100, width=300)
for i in range(10000):
for k in range(1000):
x = math.sin(math.sin(math.cos(i)))
if i%100 == 0:
cmds.progressBar(progressControl, edit=True, step=1)
def close_part(*args):
cmds.deleteUI("progress_bar")
windowUI()
Solved! Go to Solution.