Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello I have desperately been trying to get a code to work for a GUI and I canno

ID: 3795627 • Letter: H

Question

Hello
I have desperately been trying to get a code to work for a GUI and I cannot figure it out

I have a folder with 40 images

I want to be able to display these images onto an axes

When an image is dispalyed onto an axes the use will chose from one of 4 pushbuttons, with one of the pushbuttons being the correct answer

However, I am having trouble with the next part

At this step I need to be able to change the image that appears on the axes and then repeat this process as a type of game

But I cannot figure out how to do this

Basically there needs to be an 'enter' key pushbutton and when it is pressed the next file in the folder will appear on the axes

if anyone has any insight please help!

Explanation / Answer

Create a data structure (may be an array or resizeable array) Scan the folder by listing all the files (images) in putting it into the in memory data structure Also, keep a current position index which is meant to capture the idea of which file you are showing right now When enter key pushbutton is pressed increase current position index show the image from that position Some troubleshooting there, while changing image there, make sure that you are reloading/refreshing the GUI view as well so that it reflects beware to handle edge case i.e. when current position index is greater than array size, you might want to end the game or reset it to zero based on what you want to achieve

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote