shut down the viewer loop?
Hello, I've only done a cursory search on this and not finding anything. What terms should be used to search for this? Specifically, here's what I am trying to find out... My script uses viewer.ImageViewer and cycles through several images. The images are closed by clicking on the "X" in the upper right corner. After the last image is closed, the script seems to continue running but does not execute any further commands. My guess is there is a Qt loop still running that must be exited before continuing with the rest of the script. How to stop the loop and continue? Or might there be something else going on? Should I post the script? Steven
OK, this is a trimmed down version This is the part which cycles through a list of images and displays them on at a time. Each displayed image is closed by clicking the "X" on the frame: for item in existing_data_list: jpeg_name = item['jpeg'] jpeg_set = item['set_type'] jpeg_path = "" if jpeg_set == "TRAIN": jpeg_path = train_data_source_path elif jpeg_set == "TEST": jpeg_path = test_data_source_path else: break jpeg_fullname = os.path.join(jpeg_path, jpeg_name) jpeg_image = ndimage.imread(jpeg_fullname, mode="RGB") an_image = ski_viewer.ImageViewer(jpeg_image) an_image.show() here's the list it cycles through: [{'set_type': 'TRAIN', 'predicted': 9999, 'jpeg': '10_left.jpeg', 'correct': 'unknown', 'level': '0'}, {'set_type': 'TRAIN', 'predicted': 9999, 'jpeg': '10_right.jpeg', 'correct': 'unknown', 'level': '0'}, {'set_type': 'TEST', 'predicted': 9999, 'jpeg': '11_left.jpeg', 'correct': 'unknown', 'level': 9999}, {'set_type': 'TEST', 'predicted': 9999, 'jpeg': '11_right.jpeg', 'correct': 'unknown', 'level': 9999}, {'set_type': 'TEST', 'predicted': 9999, 'jpeg': '12_left.jpeg', 'correct': 'unknown', 'level': 9999}, {'set_type': 'TEST', 'predicted': 9999, 'jpeg': '12_right.jpeg', 'correct': 'unknown', 'level': 9999}] Attached a zip file with the jpegs. You'll need to change the script variables train_data_source_path and test_data_source_path to suit your pathing. Steven
Stefan, I started digging deeper and it appears some of the jpegs are the problem. For unknown reason they are causing viewer.ImageViewer to hang. Thank You. I would still be spinning my wheels searching in the wrong place. Steven On Friday, May 22, 2015 at 12:19:08 AM UTC-4, stefanv wrote:
Hi Steven
On 2015-05-21 03:58:14, Steven Drake
javascript:> wrote: OK, this is a trimmed down version
Attached, find a fully functional code snippet. This exits on my machine as soon as it is done (but I didn't modify your code at all).
Regards Stéfan
Stefan, As a follow-on to my last post... it was not the jpegs directly causing the problem. After about 18 images displayed, viewer.ImageViewer started hanging. I added into the script a line to delete the ImageViewer object after closing the window (clicking "X") and the script kept on going to finish. Seems to me like the ImageViewer objects do not completely go away after closing and at some point a memory limit -- or number of allowed ImageViewer objects -- is reached. Any thoughts? Steven
Steven, Can you try calling show() only on the *last* ImageViewer you create? On Wednesday, May 20, 2015 at 6:41:12 AM UTC-5, Steven Drake wrote:
Hello,
I've only done a cursory search on this and not finding anything. What terms should be used to search for this?
Specifically, here's what I am trying to find out...
My script uses viewer.ImageViewer and cycles through several images. The images are closed by clicking on the "X" in the upper right corner. After the last image is closed, the script seems to continue running but does not execute any further commands.
My guess is there is a Qt loop still running that must be exited before continuing with the rest of the script. How to stop the loop and continue? Or might there be something else going on?
Should I post the script?
Steven
participants (3)
-
Stefan van der Walt
-
Steven Drake
-
Steven Silvester