Improvement to imports, what is a better way ?

Cameron Simpson cs at cskk.id.au
Thu Jan 19 00:08:32 EST 2023


On 18Jan2023 16:10, Dan Kolis <dankolis at gmail.com> wrote:
>I have written a very sizable and elaborate program that uses tKinter for X11 displays of genomics.
>Yet maybe 1 of 6 times it freezes, so I decided to extract the minimum 
>that works perfectly and add back big pieces. It does it both running 
>.pyc and in VSCode.

The other thing you can do is put in a heap of print() calls in 
strategic places. See if you can get a handle on what its doing when it 
freezes. This might be iterative, zooming in on where this happens, if 
it's a specific thing.

I know this is vague. Once you find its stalling in a particular 
function (if it is) you may be able to run that function directly. Also, 
a print() at the top abd bottom/return of the stalling function. And so 
on.

If the GUI freezes, maybe you're running something time consuming inline 
in the event loop, such that it blocks reaching the "idle" point where 
the tk gui updates widgets and polls for user actions.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list