make a window of a program in python with three buttons. open image, next image and…
- User
make a window of a program in python with three buttons. open image, next image and previous image. add random checkbox and limit checkbox. set the initial state of limit and random to disabled
the open img will open a folder and list the files that fits img_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'] in the opened folder. show the total of imgs found in the folder in a label in the window. then make a list and assign a numbering to the filename in the list. the list will be file order, and the number will be img number. if i press open folder and open a folder again, it resets. if i press open folder again but don't select a folder or cancel, don't reset.
add a random state functionality. add a random checkbox on the window that if activated, it causes next button to call random img number from the index list. make sure the random function show every img on the list at least once before it shows the same img.
make the next button display the img_number on the list and add an img_count to the window that counts how many img name have been called to prompt so far. remember the order of the imgname number previously shown. if the random check button is on then it calls random img number if the random check button is off it calls the next img in the index and add the image shown to the pool of img history
on the previous button, make it so it loops back if it goes too far back. make the previous button always call the previous img shown in history. if it goes back futher than the first img number in history, it puts that img number in the beginning of the history. make sure when i press the previous button there are no duplicates, that means when i press the previous button immideately call the previous img name instead of call the current img first.
add a limit function checkbox next to a spinbox value input that update the state of limit to on and off. put it next to a spinbox input that is set to 5.
the limit state is default off. the checkbox will toggle it active, if limit is active each time after the program have shown 5 more imgs, it says "end of limit" then show another img number from the list, after 5 imgs it shows "end of limit" and so on. when the limit checkbox is deactivated, no limit is set to next img.
add comment to explain the functions
- Assistant
- User
the image count is supposed to be the number of images shown so far, in the history pool. add a number of images so far label below total number. total number is supposed to be total_number instead of count. put next and previous under open image, put random and limit under open image, put limit spinbox next to limit checkbox. put the image total under it, put imge count so far under it, then put image name under it
- Assistant
- User
the previous button reach the first image, make it call the previous image in the folder so it's not stuck. and add those images to the top of the history pool, so i can press next from there on the list. so example in a folder of 10 images: show 1,2,3,4,5, if i press previous on 5 it'll show 1,2,3,4,5,4,3,2,1,10,9 and the pool in the example would be from 1,2,3,4,5 to 10,9,1,2,3,4,5
make the next button call for the next img to be the next one in the pool until it reached the end of the pool, then add the next image in the folder or if the random funtion is on, call for random images to be added in the pool in the example : 10,9,1,2,3,4,5,6,7,8 so if the random is on then, the pool would be like 10,9,1,2,3,4,5,6,7,8,1,4,3 (the last three number is random)
now fix the limit. make the img count reset after every (limit value), so it just show the message after every 5 image if i keep pressing next . so that it's not keep calling the message if i enable the limit when img count is already 6 and
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.