Cli2Gui icon indicating copy to clipboard operation
Cli2Gui copied to clipboard

Bug: UI unresponsive after click `run` with fsg/psg

Open mokurin000 opened this issue 1 year ago • 4 comments

Before You Begin

Before proceeding, please make sure to follow these steps:

  • [x] I have checked for similar issues in the project's issue tracker.
  • [x] I have searched closed issues to see if a similar problem was reported before.

Issue Details

  1. start cli2gui UI
  2. enter arguments
  3. click Run
  4. UI will get stuck and warn unresponsive state

Description

This problem only occurs on pysimpleguiwrapper

Expected Behavior

UI should not be blocked

Actual Behavior

Unresponsive warn happens.

System Information

Please provide the following additional information about your system or environment:

  • Operating System (OS): Windows 11
  • OS Version: 22631.4249
  • Browser (if applicable):
  • Browser Version (if applicable):
  • Project Version (if applicable): 2024.2

mokurin000 avatar Oct 05 '24 10:10 mokurin000

Hey thanks for the issue, I wasn't able to replicate this locally. I've created a test file based on the code you'd shared with me previously (just removing most of the business type logic). Seems not to freeze up the ui.

image

FredHappyface avatar Oct 05 '24 12:10 FredHappyface

Hey thanks for the issue, I wasn't able to replicate this locally. I've created a test file based on the code you'd shared with me previously (just removing most of the business type logic). Seems not to freeze up the ui.

image

could you please send your test script I'm testing on https://github.com/mokurin000/fuckingfast-batch-download/commit/test-freeze

also, did you add some fake payload (for exmaple time.sleep() ?

mokurin000 avatar Oct 05 '24 12:10 mokurin000

Yeah sure its https://github.com/FHPythonUtils/Cli2Gui/blob/master/tests/argparse/test_22.py

Can't seem to view the image

Ah could it be the threading do you think? Shouldn't block dearpygui though? Unless I need to think about spawning a UI thread perhaps

FredHappyface avatar Oct 05 '24 15:10 FredHappyface

Yeah sure its https://github.com/FHPythonUtils/Cli2Gui/blob/master/tests/argparse/test_22.py

Can't seem to view the image

Ah could it be the threading do you think? Shouldn't block dearpygui though? Unless I need to think about spawning a UI thread perhaps

Ah, I think I may have misdescribe. I encountered blocking when I did not open another thread to start the main function. If Thread.start() is replaced with Thread.run(), it will run the task in the current thread, and then because the task is running in the UI thread, it will block the UI. What I did to solve the problem was to open the task in another thread (the wrapper)

mokurin000 avatar Oct 05 '24 15:10 mokurin000

Ah right thanks for the clarification. I'll give that a go when I get the chance. I don't know enough about the inner workings of dearpygui to know if thread.run should block the UI thread but it sounds like it should?

I'll do some investigation and get back to you if that's alright? :)

FredHappyface avatar Feb 16 '25 22:02 FredHappyface

sorry for the misoperation..

dearpygui may spawns own event loop thread by default While psg/fsg does not. Thread.run() will simply run the Callable object in current thread

mokurin000 avatar Feb 17 '25 03:02 mokurin000