Let say I have an Operator.bl_idname=download.image with url: StringProperty(), I am drawing this operator in a Panel using for loop.
def draw(self, context): for url in url_list: layout.operator('download.image').url = url # show progress instead of operator layout.progress() # something something like this:
import bpy class Download(bpy.types.Operator): bl_idname = "download.image" bl_label = "Download" bl_options = {"REGISTER", "INTERNAL"} url: bpy.props.StringProperty(name="URL", default="https://picsum.photos/200/300") def execute(self, context): self.report({"INFO"}, f"Downloading {self.url}") return {"FINISHED"} class HelloWorldPanel(bpy.types.Panel): """Creates a Panel in the Object properties window""" bl_label = "Hello World Panel" bl_idname = "OBJECT_PT_hello" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "Download" def draw(self, context): layout = self.layout for url in range(10): col = layout.column() op = col.operator("download.image", text="Download") # https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.progress col.progress(text="Downloading", factor=0.0) # in the place of download.image operator def register(): bpy.utils.register_class(Download) bpy.utils.register_class(HelloWorldPanel) def unregister(): bpy.utils.unregister_class(Download) bpy.utils.unregister_class(HelloWorldPanel) if __name__ == "__main__": register() I want to run this operator to download the images using threads and want to show the progress of the download in place of the download operator.
How to achieve this?