- Pushbutton #1 (load images): When the user presses this button, they are queried to select a directory of images from file. Those images are all loaded into the GUI and stored in a variable (e.g., I).
- Axes: I assume there is an axes in your GUI to display the images. Use a variable (e.g., current_image) that keeps track of the index of which image to show. When that variable changes (from the Pushbutton #2), use a listener function to update the image that is shown in the axes.
- Pushbutton #2 (change images): When the user presses this button, the variable current_image updates (triggering the update of the image shown in the axes). In fact, if it were me, I would use a slider that ranges from 1 to the number of images so that the user can move forward and backward through the directory of images; in this case, you can simply use the value of the slider instead of current_image.
- Pushbutton #3 (starts imfreehand tool): you don't explicitly say this, but I'd suggest incorporating the imfreehand as a button that the user selects. In this way, the user can decide when they want to draw on the image, instead of being forced in a for loop.
A button in GUI to move on to next image from a for loop in a different push button.
10 views (last 30 days)
When the user presses, the first push button the program allows it to select some directories and then starts displaying the images from the directories in a for loop. So, the first image will be shown and the user will do some imfreehand drawing in it.
I want a separate push button that will allow them to go to the next iteration/picture in the for loop running from the first push button. Is there any way to do this? I don't want to resort to message boxes at this time.
Matthew Eicholtz on 2 Aug 2017
I would advise against "displaying the images from the directories in a for loop." What about the following setup?
Does this make sense? Let me know if anything is unclear.