Build an Image Viewer App With Python and TKinter - Python Tkinter GUI Tutorial #9
Why Stack Overflow recommends it
Stack Overflow users link it as a reference for building a Tkinter image viewer or gallery, and many questions are about code copied from it.
Recommended by 1 people across 1 different months, 2020 to 2021.
What it is
A 23-minute tutorial from John Elder (Codemy) that builds a simple image viewer in Python with Tkinter and PIL. It covers displaying images, forward and back buttons, and a status bar, as part 9 of a Tkinter GUI series.
What people said
Recommends Matiiss · 2021-08 · Stack Overflow · on “Display images in “Gallery” using tkinter?”
you can't really use loops in the same thread/process as `tkinter`, either use `threading` (or `multiprocessing` but `threading` is easier) or use `.after()` "loops", and yes it is possible to create a gallery, and adding to @martineau comment you can find tutorials on youtube too like this one about creating an image viewer [this video] (btw there might be a tutorial for gridding images too or another tutorial that covers a "gallery" type thing)
Cites bayudha2 · 2020-04 · Stack Overflow · on “Python - PIL Image open, How to open all image in the directory and keep it update”
i follow tutorial on youtube This one [this video] . the problem is how to open all the images in the directory without declaring 1 by 1... and name it like in the img_list array here is part of the code : my_img = ImageTk.PhotoImage(Image.open("1.jpg")) my_img1 = ImageTk.PhotoImage(Image.open("2.jpg")) my_img2 = ImageTk.PhotoImage(Image.open("3.jpg")) img_list = [my_img, my_img1, my_img2]
Cites Nich-olai Kenobi · 2020-06 · Stack Overflow · on “NameError in Python for a function call”
I'm making a new button in Tkinter. I have to define a delete function and use the passed information. I am running into indentation errors when I'm defining variables. You might have seen this code before in Codemy Image Viewer App at [this video] def delete(image_number): global the_picture global button_forward global button_back os.remove(names[image_number]) button_forward = Button(root, text=">>", command=lambda: forward(image_number+1)) button_back = Button(root, text="<<", command=lambda: back(image_number-1)) However, I get an error: Exception in Tkinter callback Traceback (most recent call last): File "E:\Programming\Anaconda\lib\tkinter\__init__.py", line 1705, in __call__ return self.
Cites NightEye · 2021-08 · Stack Overflow · on “Accessing all files in Google Drive API with a shared link”
Since you were accessing an image independently by getting the link for each one, accessing that link will only access that particular image. This boils down on how you make use of the files that you were able to fetch using the API. You will need to create your own image viewer to view those images using the links you got. You can use TKinter if it is an option. Reference: Build an Image Viewer App With Python and TKinter [this video] Load an Image from a URL at TKinter [LINK]
Cites Matiiss · 2021-08 · Stack Overflow · on “Why does this happens to my tkinter code?”
First I will answer the question: why do buttons disappear when they are clicked in that sequence? This is because when start() is called it grids the first image, then when rightpic() gets called, it checks what is the value of cimage and acts accordingly, since when you first start the program the value is set to "flower1.jpg" it evals the first if statement and forgets the first image gridded and grids the second image, then you call close() , again it checks the image and removes everything, however, cimage is now "flower2.jpg" and when you call start() again it grids the first image, but when calling rightpic() it goes to the elif cimage == "fower2.jpg" but since the second image is not
Cites Naky · 2021-10 · Stack Overflow · on “Is a lamdba:function() inside the same function considered recursive?”
I was watching this tutorial of how to make an image viewer: [this video] Basically my question is if this part of code is considered recursive or not and why: def forward(image_number): global my_label global button_forward global button_back my_label.grid_forget() my_label = tk.Label(image=image_list[image_number-1]) button_forward = tk.Button(root, text=">>", command=lambda:forward(image_number+1)) #is this recursive? button_back = tk.Button(root, text="<<", command=lambda:back(image_number-1))