'how would i integrate a progressbar into this code? ive actually got a progressbar in the code, i just need someone to show me how to make it work

how would i integrate a progressbar into this code? ive actually got a progressbar in the code, i just need someone to show me how to make it work.thanks. the way i've got it now, the progressbar runs and then my code runs. I need it to work with def launch_5.

#!/usr/bin/env python3
import os
import subprocess
import tkinter as tk

import time
from tqdm import tqdm

for i in tqdm (range (100), desc="Loading..."):
    pass 


def launch_1():

    p1 = subprocess.Popen(['ltsp',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def launch_2():
    p1 = subprocess.Popen(['ltsp', 'info',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
print(output)
def launch_3():
    p1 = subprocess.Popen(['ltsp', 'ipxe',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def launch_4():
    p1 = subprocess.Popen(['ltsp', 'initrd',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def launch_5():
    p1 = subprocess.Popen(['ltsp', 'image',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def launch_6():
    p1 = subprocess.Popen(['ltsp', 'kernel',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def launch_7():
    p1 = subprocess.Popen(['ltsp', 'nfs',], stdout=subprocess.PIPE)
    output = p1.communicate()[0]
    print(output)
def printout():
    #one that finally works
    label = tk.Label(root, text='Of all the buttons on here, the exit button works      better than almost any of them', wraplength=300, justify="center")
    label.pack()
root = tk.Tk()
root.geometry('400x600')
root.title('LTSP')


button1 = tk.Button(text='ltsp', command=launch_1).pack()
button2 = tk.Button(text='ltsp info', command=launch_2).pack()
button3 = tk.Button(text='ipxe', command=launch_3).pack()
button4 = tk.Button(text='initrd', command=launch_4).pack()
button5 = tk.Button(text='image /', command=launch_5).pack()
button6 = tk.Button(text='kernel', command=launch_6).pack()
button7 = tk.Button(text='nfs', command=launch_7).pack()
button8 = tk.Button(text='Exit', command=root.destroy).pack()
button9 = tk.Button(root, text='one that actually works', command=printout).pack()

    label = tk.Label(text='Im trying to get a progress bar to work with the Image    function of this LTSP program. It doesnt seem as if im having much success. The code Ive included runs and then the script itself executes and I want it to work with the image function because the Image function takes about ten minutes and I want a progressbar to work with it so ill know my program hasnt crashed. I know it works, but anyone else would think the program had crashed.', wraplength=300, justify="center")

label.pack()

root.mainloop()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source