How to Create Proogress Bars in Dynamo (Python Script)

Hi Everyone. I don’t know if this is a silly question of mine? but now I need to figure it out. I have created 1 progress bar from Window Form. Is there any way I can run it and display % like picture #2. I really need and learn it. Help me

import clr
import System
from System.Collections.Generic import *

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import*

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import clr
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
from System.Drawing import Icon
from System.Windows.Forms import Application, Form, ProgressBar, Label
from System.Threading import ThreadStart, Thread

clr.AddReference('IronPython')
from IronPython.Compiler import CallTarget0


class MainForm(Form):
    	def __init__(self):
		self.InitializeComponent()
	
	def InitializeComponent(self):
		self._progressBar1 = System.Windows.Forms.ProgressBar()
		self._label1 = System.Windows.Forms.Label()
		self.SuspendLayout()
		# 
		# progressBar1
		# 
		self._progressBar1.Location = System.Drawing.Point(12, 48)
		self._progressBar1.Name = "progressBar1"
		self._progressBar1.Size = System.Drawing.Size(409, 33)
		self._progressBar1.TabIndex = 0
		self._progressBar1.Click += self.ProgressBar1Click
		# 
		# label1
		# 
		self._label1.Location = System.Drawing.Point(189, 93)
		self._label1.Name = "label1"
		self._label1.Size = System.Drawing.Size(42, 23)
		self._label1.TabIndex = 1
		self._label1.Text = "0.0%"
		self._label1.Click += self.Label1Click
		# 
		# MainForm
		# 
		self.ClientSize = System.Drawing.Size(434, 187)
		self.Controls.Add(self._label1)
		self.Controls.Add(self._progressBar1)
		self.Name = "MainForm"
		self.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		self.Text = "Test ProgressBars"
		self.ResumeLayout(False)



	def ProgressBar1Click(self, sender, e):
    
		pass

	def Label1Click(self, sender, e):
		pass

f = MainForm()
Application.Run(f)
OUT = f

You can research an open source in here
dnenov/ProgressBar (github.com)

4 Likes

Thank You…!