PySimpleGUI / PySimpleGUI/PySimpleGUI

[Bug] Nested OneLineProgressMeter causes parent to break or skip

Open
#3,516 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Type of Issues (Enhancement, Error, Bug, Question)
Operating System

Any

Python version

3.7

PySimpleGUI Port and Version

PySimpleGUI Version:
4.30.0
tkinter version:
8.6

Your Experience Levels In Months or Years

3y___ Python programming experience
20y___ Programming experience overall
no_ Have used another Python GUI Framework (tkinter, Qt, etc) previously (yes/no is fine)?

Description of Problem / Question / Details

OneLineProgressMeter causes break upon completion of progress meter when used per the recommended method:
if not OneLineProgressMeter(values):
break

I found this maybe happening only when using multiple meters and nested loops. If you run the code below what you will find is that when the second progress meter finishes it seems to trigger the break (or something else?) which causes the first array to skip an item or end processing.

Code To Duplicate

I am going to approximate my code below:

import PySimpleGUI as sg

array1 = [1,2,3,4]
x = 0
for item in array1:
     x = x + 1
     if not sg.OneLineProgressMeter('123', x+1, len(array1), 1):
            break
     array2 = [A,B,C,D]
     for itemb in array2:
              y = y + 1
             if not sg.OneLineProgressMeter('123',yt+1, len(array2), 2):
                   break


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OneLineProgressMeter behavior described in the nested-loop reproduction and run the provided Python example after correcting its apparent typos. Verify whether completion of the inner meter causes the outer loop to skip an item or break unexpectedly; done means nested meters complete without disrupting the parent loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.