0

Here is the pare of my code that is relevant.

    while True:
    p = int(psutil.cpu_percent(interval=0.1))
    progressbar = ttk.Progressbar(orient=HORIZONTAL, length=screen_width, mode='determinate')
    progressbar['value'] = p
    progressbar.update_idletasks()

So when I run this is just spits freezes on the first value it gets from the p variable. I have tried setting VARIABLE instead of setting value like this. Please help.

j08691
  • 204,283
  • 31
  • 260
  • 272
  • You create a new Progressbar on each loop iteration. Is that really what you want? – FamousJameous Feb 27 '18 at 23:07
  • I just want to update it. Maybe I should create it once then just change the variable. But in that case do I use variable or value. @FamousJameous – Nicholas Ficara Feb 27 '18 at 23:16
  • Yes, create the Progressbar once outside of the loop, pack it and then update the value in the loop. See https://stackoverflow.com/a/7310778/3901060 for an example. – FamousJameous Feb 27 '18 at 23:20
  • Thank you so very much for helping. Life saver. I have been working on this for 5 hours. @FamousJameous – Nicholas Ficara Feb 27 '18 at 23:27

0 Answers0