No video

Build an Image Viewer App With Python and TKinter - Python Tkinter GUI Tutorial #9

How to Build an Image Viewer App With Python and TKinter. In this video we'll build a cool little Image Viewer app with Python and tKinter.
In this series I'll show you how to create graphical user interfaces for Python with Tkinter. TKinter comes with Python already, so there's nothing to install!
✅ Watch The Other Videos In This Python Playlist:
bit.ly/2UFLKgj
▶️ See More At:
Codemy.com
✅ Join My Facebook Group:
bit.ly/2GFmOBz
✅ Subscribe To My KZread Channel:
bit.ly/2IGzvOR
▶️ Learn to Code at Codemy.com
Take $22 off with coupon code: youtube

Пікірлер: 399

  • @Codemycom
    @Codemycom4 жыл бұрын

    ▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My KZread Channel: bit.ly/2UFLKgj bit.ly/2IGzvOR ▶️ See More At: ✅ Join My Facebook Group: Codemy.com bit.ly/2GFmOBz ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt! Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @sai wary You're very welcome!

  • @DP-xz7cc
    @DP-xz7cc4 жыл бұрын

    Personally, i love the way how the code gets better and better with each substep of the tutorial instead of presenting the perfect solution at a stroke. Great tut!

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Thanks!

  • @kanwaradnan4849
    @kanwaradnan48492 жыл бұрын

    I can't believe you can also think like a beginner student.😳 You're really a super duper teacher.

  • @Codemycom

    @Codemycom

    2 жыл бұрын

    Thanks

  • @dylancampbell6433
    @dylancampbell64333 жыл бұрын

    I seriously love the series. This is the only in depth tutorial on tkinter and I want to say thank you. Replace pack_forget() with grid_correct and instead pack everything in your app and you will see the issue with the function

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Glad you like it!

  • @grzptk6890
    @grzptk68904 жыл бұрын

    Greetings from Poland bro! You're the best! Thanks for your wonderful work :-)

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Hey, thanks!

  • @janpaweii3115
    @janpaweii3115 Жыл бұрын

    this series is amazing. and its for free. you are great sir

  • @musicality2654
    @musicality26544 жыл бұрын

    Thanks so much. I kinda have the hang of doing stuff similar to this

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Glad you're enjoying it!

  • @joshm9058
    @joshm90584 жыл бұрын

    I enjoyed the video. I changed mine so I didn't have to remove/recreate the buttons each time by pulling in the list size and having a global variable for the current image.Then I just added/subtracted from the current image variable.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Nice!

  • @eshaangupta4101
    @eshaangupta41013 жыл бұрын

    I literally spent 3 seconds watching this video and my bug has been fixed. I don't know if that is good or bad for you but great content!!

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Glad you liked it!

  • @bazareta6936
    @bazareta69364 жыл бұрын

    Thanks for these tutorial I guess here you can use the recursion function in forward() and back() functions It will be more pythonic and less typing as well Thanks again👍

  • @guyincognito5614

    @guyincognito5614

    3 жыл бұрын

    what are those????

  • @BentleyGadget

    @BentleyGadget

    Жыл бұрын

    Yes, what@@guyincognito5614 said. Please come back and explain!

  • @hosseinghanaati728
    @hosseinghanaati7283 жыл бұрын

    I really wanna thank you because you made me have more faith in myself

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Awesome, glad I could help!

  • @SammarpanDasguptaOfficial
    @SammarpanDasguptaOfficial3 жыл бұрын

    You are just awesome....This all lectures are very helpful to me to make my project as well.....Thanks for that nice guidance.

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Most welcome 😊

  • @joshwzr1257
    @joshwzr1257 Жыл бұрын

    I automatically smashed the like button and i like how easily you go about the teaching sir. Thank you

  • @Codemycom

    @Codemycom

    Жыл бұрын

    Thank you!

  • @ashrsfsiliman452
    @ashrsfsiliman4523 жыл бұрын

    Great job deserving of thanks عمل رائع يستحق الشكر

  • @rahulsailwal4025
    @rahulsailwal40254 жыл бұрын

    Thank you very much for the video. Looking forward for more. Yes i liked it and subscribed :)

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Thanks!

  • @spot1401
    @spot14013 жыл бұрын

    my student will be very happy when she can click through 5000 images and the results are automatically written to a csv-file. you helped me a lot. thank you

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Happy to help!

  • @creativecore3575
    @creativecore35753 жыл бұрын

    thank you again for uploading this great work !

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Glad you enjoy it!

  • @Kaisen947
    @Kaisen9474 жыл бұрын

    Thank you very much for this training

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Glad you're enjoying it!

  • @michaelherediaperez5490
    @michaelherediaperez54903 жыл бұрын

    Great series of videos, it has help me a lot!

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Glad to hear it!

  • @mobarakjama5570
    @mobarakjama55704 жыл бұрын

    You can't imagine the kind of crab I had to go through in order to make it work but it was worth it, it was very educational, to say the least.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Glad you got it working!

  • @mobarakjama5570

    @mobarakjama5570

    4 жыл бұрын

    @@Codemycom Thanks

  • @devanshisoni6649
    @devanshisoni66493 ай бұрын

    Really helpful! thank you so much!

  • @Codemycom

    @Codemycom

    3 ай бұрын

    Welcome!

  • @ujudjyfjyk
    @ujudjyfjyk4 жыл бұрын

    Great tutorials !!

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Thanks!

  • @piyalikarmakar5873
    @piyalikarmakar5873 Жыл бұрын

    Thank you so much sir for such expressive tutorial. Sir, it will be really helpful if you kindly launch a tutorial video on photographic translation ( text to pictogram translation ). Thanks

  • @bolhavoadora
    @bolhavoadora4 жыл бұрын

    My code ended up way different, i watch the begging of the video and decided to code before watch the rest and i used .configure(image=image_list[number]), so i didn't need to take the image of the grid or re-do the button or the label. Great video, thank you!

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Nice job!

  • @dylancampbell6433

    @dylancampbell6433

    3 жыл бұрын

    Yes! This! In the video he just makes a shit ton of buttons overlay eachother. Super inefficient.

  • @parsabahrambeik4381
    @parsabahrambeik43813 жыл бұрын

    Hi, thank you very much for your video. You helped me a lot with the database. AND.....

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Glad it helped!

  • @adityachoudhary4045
    @adityachoudhary40453 жыл бұрын

    Awesome tutorial ❤️❤️

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Thanks!

  • @SameerKhanna-zh7iq
    @SameerKhanna-zh7iq Жыл бұрын

    Thanks for this great toturial

  • @Codemycom

    @Codemycom

    Жыл бұрын

    welcome

  • @alfredzhang7932
    @alfredzhang79322 жыл бұрын

    Thank you. What should I do, if some pictures are too big and cannot be displayed fully in the widget window?

  • @dipankarpanda8414
    @dipankarpanda84142 жыл бұрын

    Hello Sir, Thanks for such womderful tutorials. a great learning for me. I also want to ask one thing- here we hard coded the images, for example 5 images. If I put another image in the folder it will not show. Can we make the code like whatever the number of images we add, it will show ALL one after another, like any photo viewer we use in our PC. Again thanks for your detailed tutorials.

  • @kadaganolan
    @kadaganolan3 жыл бұрын

    In this case, how to go forward or backwards using the keyboard arrows? because here we cannot use the event method in these functions if there is already a parameter. Thanks

  • @mohamadabouelela1993
    @mohamadabouelela19934 жыл бұрын

    I just finished this image viewer App... worked really nice :D .. I had to pause the Video do some coding and review the video again couple of times...I like this Tkinter playlist a lot and looking forward to finish all its apps. I like your tempo when talking and the way you think loudly of the problems as you code and solve the problems... I'm new to coding trying to self learn so any advice is very much welcomed ... I started with Python basics about 2 month ago then OOP , I did some introduction to Machine learning with Python as well as I'm very interested in this section ... Thanks A LOT for your videos .. if you Have any advice for me that will be great

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Glad you're liking the videos! My advice is just to stick with it! :-)

  • @khryztianissacharreal3806
    @khryztianissacharreal38063 жыл бұрын

    Thanks a lot

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Most welcome

  • @nima.sayadi
    @nima.sayadi4 жыл бұрын

    Thanks for your good work , we don’t need the back function by the way .

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    You're welcome

  • @aryanshbhargavan2775

    @aryanshbhargavan2775

    3 жыл бұрын

    pls elaborate?

  • @Oddvar-ff9fy
    @Oddvar-ff9fy Жыл бұрын

    Very much appreciated. \o/

  • @Codemycom

    @Codemycom

    Жыл бұрын

    Glad you enjoyed it!

  • @user-kn6jg8kj6d
    @user-kn6jg8kj6d4 жыл бұрын

    Thanks :))

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    You're very welcome!

  • @tor6953
    @tor69538 ай бұрын

    Thank you

  • @Codemycom

    @Codemycom

    8 ай бұрын

    welcome

  • @MrJzvoyeur
    @MrJzvoyeur4 жыл бұрын

    hello, in 14:43 a new button is defined for every step forward or backward. what is the advantage? We could just keep track of the current image in a variable: img_idx = 0 forward: img_idx = (img_idx + 1) % len(image_list) back: img_idx = (img_idx - 1) % len(image_list)

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    there are always infinite ways to do a thing

  • @elbarto4193

    @elbarto4193

    3 жыл бұрын

    ​@@Codemycom "There should be one - and preferably only one - obvious way to do it" (The Zen of Python) :-)

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    @@elbarto4193 Incorrect, I've been coding for 30+ years, you can always do a thing a million ways and there is no "right" way in the real world...only the easiest fasted way for your situation

  • @guyincognito5614

    @guyincognito5614

    3 жыл бұрын

    @@Codemycom but theres are confusing ways and siple ones.

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    @@guyincognito5614 confusing to who? It’s all relative, why argue semantics? Lol

  • @Lennardish
    @Lennardish Жыл бұрын

    Hello John. How about inserting a "fake" image as the "first image" . image_list = [fake_img, my_img1,my_img2,my_img3,my_img4] Then image1 will be image[1]

  • @kasoa.thourcans124
    @kasoa.thourcans1243 ай бұрын

    I like doing simple things, in my case the function to change the image is simpler: First change is that below the image_list, I added another variable: image_number Then the functions to change the image were in just 1 function: .def change_image(direction): . if direction == "forward": . if image_number . image_number = image_number + 1 . else: . image_number = 1 # This way instead of stop and disable the buttons, it just loops . if direction == "back": . if image_number > 0: . image_number = image_number - 1 . else: . image_number = len(image_list) # This way instead of stop and disable the buttons, it just loops . my_label.grid_forget() . my_label = Label(image=image_list[image_number-1]) . my_label.grid(row=0, column=0, columnspan=3) So as the function is like that, the buttons to command of the buttons to change the image is: command=lambda: change_image("forward") # or "back" if it's the button_back

  • @samsilarefeen2466
    @samsilarefeen24663 жыл бұрын

    My question is How does the exit button work though forward function is called? There is no declaration of button_exit yet, how the button work?

  • @8L4CK_W0LF
    @8L4CK_W0LF3 жыл бұрын

    Can anybody please help me when clicking forward button showing: if master._last_child_ids is None: AttributeError: 'PhotoImage' object has no attribute '_last_child_ids'

  • @TheManuelpedroza
    @TheManuelpedroza3 жыл бұрын

    thank"s for the tutorials, can you make a tutorial of how to make a slide image to paint in canvas, how do it,

  • @MoIbrahem99
    @MoIbrahem993 жыл бұрын

    I am a little lost in the part of the forward button and why should we forward 2 I tried forwarding 0 and not doing the subtraction line in the function and it worked but when I do the limit for image number it doesn't work and can't understand why?

  • @felixmontanez4090
    @felixmontanez40904 жыл бұрын

    i dont understand how image number value will change? the variable isnt chnged but how will it append?

  • @user-vp1ev6rg1i
    @user-vp1ev6rg1i3 жыл бұрын

    Thank You so much , would you tell me how can I set Pic size please ?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    I have a video on that further down in the playlist.

  • @slayeroff7798
    @slayeroff77984 жыл бұрын

    Hey..Just a doubt can i do this for loading the images: dir_asker = askdirectory() #print(dir_asker) image_bin = [] for img in os.listdir(dir_asker): if img.endswith(".png") or img.endswith(".jpg"): image_bin.append(img) #print(image_bin)

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    try it and see

  • @TahmidulAzomSany
    @TahmidulAzomSany3 жыл бұрын

    Great

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    thanks

  • @agorafood2233
    @agorafood2233 Жыл бұрын

    I’m having a problem with the photo path. I have several photos saved in the same directory as my viewing app. When I copy and past the path in to the label, it opens the wrong pic. It’s a pic that should have been overwritten and I cant find it in any of my files. I have pasted multiple paths to different pics and they all out put the same mystery pic.

  • @inactiveaccountprobably253
    @inactiveaccountprobably2534 жыл бұрын

    Hello, I'm having trouble with one of my images, its rather large and takes up the whole screen, so i cant click the forward or back arrow. Is there any way i could fix this?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Use a smaller image or resize it. I have a video in this playlist on resizing images with Pillow.

  • @shivanshukamboj7940
    @shivanshukamboj79403 жыл бұрын

    Its like watching Live TV......thats what i like

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    ha

  • @shivanshukamboj7940

    @shivanshukamboj7940

    3 жыл бұрын

    @@Codemycom because you didn't cut the extra part where you correct some things .......

  • @arnabmukherjee4672
    @arnabmukherjee46724 жыл бұрын

    First of all Thanks a lot for delivering such gr8 lessons... One thing is that these forward and back functions are calling themselves as u've shown...so isn't this a recursive call ???

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    nope

  • @matthewkeen6281
    @matthewkeen62812 жыл бұрын

    nice..

  • @Codemycom

    @Codemycom

    2 жыл бұрын

    Thanks..

  • @johnpro2847
    @johnpro28475 жыл бұрын

    Aspen ..mentioned in other vids John.I suspect you like to ski there..?

  • @Codemycom

    @Codemycom

    5 жыл бұрын

    nah, it's the name of my dog :-p

  • @zabeelbasheer3845
    @zabeelbasheer38452 жыл бұрын

    Thank you for this tutorial. I was using my own pics for the image viewer. I noticed that if the size of the image is large (2400x1600), the window is not scaling, nor the image being fit into the original window. It doesn't show any scroll bar too. Is there a quick fix to overcome this by fitting large images also within the app window? I tried fixing the size of the root using geometry function, but that did not fix this problem.

  • @furrane

    @furrane

    2 жыл бұрын

    You can use the reduce method : my_img1 = ImageTk.PhotoImage(Image.open('images/test1.jpg',).reduce(2)) Here the image would be half the width and length

  • @hitanshugupta4612

    @hitanshugupta4612

    2 жыл бұрын

    same issue i am facing :)

  • @hitanshugupta4612

    @hitanshugupta4612

    2 жыл бұрын

    @@furrane hahah :P thanks dude this reduce worked for me but the only changed I had to make in that was need to replace 2 with 8 :P

  • @furrane

    @furrane

    2 жыл бұрын

    @@hitanshugupta4612 You're welcome =)

  • @NO-qz5pv
    @NO-qz5pv4 жыл бұрын

    subscribed

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Awesome!

  • @alexanderak3881
    @alexanderak38814 жыл бұрын

    The images I added take up the entire window (height wise), even when I drag the window corner to make it bigger. Is there any way to resize the pictures so the buttons on the bottom are visible?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    You can use height and width attributes

  • @harshwardhanshirodkar769

    @harshwardhanshirodkar769

    3 жыл бұрын

    @@Codemycom using height and width parameters crops the image, is there a way to fit them to our pane size?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    @@harshwardhanshirodkar769 Yes, I've got a video on that in the playlist

  • @harshwardhanshirodkar769

    @harshwardhanshirodkar769

    3 жыл бұрын

    @@Codemycom Awesome !! I hope to cover it soon. Great job on the videos btw🙌🙌, I'm able to easily pick up the topics.

  • @yuvrajverma7013
    @yuvrajverma70133 жыл бұрын

    I am getting error like window has no attribute icon bitmap what should I do any tip

  • @lynahlerato1845
    @lynahlerato18453 жыл бұрын

    Hey, Nice one! Thanks for the video. How can a put this application on a website?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Not possible

  • @mahmudulhasanjasin5146
    @mahmudulhasanjasin51464 жыл бұрын

    we usually define a global variable to use it anywhere in the code. If that is true then why have we defined it twice here in two different functions? Please clarify that

  • @bazareta6936

    @bazareta6936

    4 жыл бұрын

    Mahmudul Hasan Jasin As far as I know there is no need to define these global vars in the second func(back) Only you need to call it from the global once to be updated otherwise it will be treated as local

  • @risky_g_1123

    @risky_g_1123

    4 жыл бұрын

    or........ you don't need to write a global variable if you put your tkinter in a class, just put self

  • @qwiklabmyst
    @qwiklabmyst4 жыл бұрын

    Sir how can we create image choose options so that i can choose any image by browsing through inside pc and store inside a variable and print it as labels on root like we do with text inside entry box . Is it possible sir to make such features in tkinter python . By clicking a button I want just to know can we creat this statement Photo=PhotoImage(file='first.png') Externally with writing actually code inside our program if we sucess in writing this then we can make image choose field only will will provide variable name and image name and our program will setup everything

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Check the playlist, I think I have videos on most of that...

  • @suwort7250
    @suwort72503 жыл бұрын

    hey, great video. but i have a problem. The forward and backward-Button redouble. I mean when I click on forward I have then two forward-buttons: the original one and the one defined in the function. What am I doing wrong?

  • @harshkakkad7944

    @harshkakkad7944

    3 жыл бұрын

    You might have to define row and column of those buttons in grid function

  • @user-wi6rn9zx9x
    @user-wi6rn9zx9x10 ай бұрын

    Hi man How can i change it to images automatically change? Thanks for answer

  • @subhiyousef7240
    @subhiyousef72403 жыл бұрын

    hy thanks for your video but i have problem in make disabled it is not work this is my code [ button_forward = Button(root, Text=">>", state=DISABLED) ]

  • @MrGold-17
    @MrGold-173 жыл бұрын

    Why do us disable the forward (or backward)-Button when you reached the last last (or first) Element? You could just start at the beginning (or end)...

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Why not?

  • @MonkeyDLuffy-ld5iy
    @MonkeyDLuffy-ld5iy3 жыл бұрын

    without make a new label we can do the following to change the image:- my_label['image'] = image_list[image_number `- or + 1`]

  • @user-xo9fh2jb9x
    @user-xo9fh2jb9x Жыл бұрын

    Hello, first of all, thank you! I have one ''small'' issue, I'm using jpg pictures, its working, but! the frame keeps adjusting to the picture size and if picture size is too big it overlaps buttons and then I'm stuck. So, my question is: what can i do so frame remains unchanged, but the pictures shrink so they fit, not vise versa? i could put a frame size but it wont fix the issue...

  • @Codemycom

    @Codemycom

    Жыл бұрын

    I have videos on the playlist on resizing images with Pillow (PIL).

  • @parshuram3272
    @parshuram3272 Жыл бұрын

    heey awesome

  • @Codemycom

    @Codemycom

    Жыл бұрын

    thanks!

  • @2noiembrie83
    @2noiembrie83 Жыл бұрын

    Hmm, how would we go about having that image list populated with all the files in images directory, regardless of how many they are?

  • @Codemycom

    @Codemycom

    Жыл бұрын

    Use a loop

  • @practicalbong1497
    @practicalbong1497 Жыл бұрын

    TypeError: previous_image() missing 1 required positional argument: 'image_number', i have pass the parameter still ,def previous_image(image_number) , when you initialize the back button command you have not put any parameter , i believe there is a problem

  • @arxios2072
    @arxios20724 жыл бұрын

    Hey dude, love your vids- they're really helpful. Got a question however; can you explain to me why I get an error when I put the .grid lines on the same line as the definition of the variable? Like e.g. label = Label(image=img1).grid(row=0,column=0) Why does this not work with the grid.forget() function? Thanks

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Yeah this won't ever work when you then later try to call a function on it. Has something to do with calling a function on a thing that already has 2 other functions attached to it..if that makes any sense.

  • @ojingpeteros

    @ojingpeteros

    4 жыл бұрын

    hi have you resolve this sir same issue here

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@ojingpeteros As I said above, you can't call a function on it later if your string things together...there's nothing to resolve, you just have to separate them.

  • @wrongloop

    @wrongloop

    4 жыл бұрын

    @@Codemycom Thanks, had the same problem, and found it by trial and error(before reading this comment), thanks for the explanations.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@wrongloop Sure thing

  • @adamhiatt5512
    @adamhiatt55123 жыл бұрын

    When I created the image viewr the image is very large and takes up the whole window, if I comment out the image label then I can see the other buttons but when I print the image again the buttons become hidden. Any advice on this one?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Are you using a very large image?

  • @user-rb6zr2uk7y
    @user-rb6zr2uk7y5 жыл бұрын

    Can we apply further operations in those image

  • @Codemycom

    @Codemycom

    5 жыл бұрын

    Sure, you can do anything you want :-)

  • @landesmm
    @landesmm Жыл бұрын

    I hate to jump on an old thread here but I am stumped. Running M1 Mac Mini with Ventura (current production release), and Python 3.11. I can't get Pillow (PIL) to load at all. I've tried loading it through PIP, PIP3 and conda (miniforge3). All say they load but the simple command 'from PIL import Image' says it cannot find module not found. I know some tools are iffy on M1 but I am sure by now others have this working. Any Mac M1 folks out here that know the trick?

  • @ojingpeteros
    @ojingpeteros4 жыл бұрын

    hi sir good afternoon Thank you for the wonderful tutorial is very useful for as a beginner I have some question if you dont mind it is this possible to add the text or photo description in the below pictures if yes, kindly teach me.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Yes of course it's possible. Keep watching the videos to learn to do it yourself.

  • @ojingpeteros

    @ojingpeteros

    4 жыл бұрын

    @@Codemycom yes sir correct i got it. i just add label then chance the row

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@ojingpeteros Yep!

  • @ojingpeteros

    @ojingpeteros

    4 жыл бұрын

    @@Codemycom thank you sir for the knowledge.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@ojingpeteros Happy to help!

  • @lzh00
    @lzh004 жыл бұрын

    Sorry if I ask so much, I just can't get why do we pass image_number parameter (2) to the forward function and then do image = image_list[image_number-1]. Can I directly pass 1 so we don't need to do -1?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Try it and see

  • @lzh00

    @lzh00

    4 жыл бұрын

    @@Codemycom I tried and things doesn't add up, I know your method is right but I just don't understand why. I'll try to spend some time on it.

  • @arpit27953
    @arpit279533 жыл бұрын

    In my program I m not able to print the image ?? Can you please help and tell what kind of images we can print in gui using previous program

  • @errorhostnotfound1165

    @errorhostnotfound1165

    3 жыл бұрын

    You are trying to print an image? To the terminal? If your trying to put it in the gui use pack() or grid(row=0, column=0, columnspan=3) the values for row column and columnspan are just examples

  • @mohammadkhalilnawid650
    @mohammadkhalilnawid6504 жыл бұрын

    You called forward() function inside itself though it is not a recursion, how is that possible and it didn't work for me. Could plz answer sir!

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    I mean...you see in the video how I did it.... check your code for typos.

  • @lasindukashmira7272
    @lasindukashmira72723 жыл бұрын

    global image For i in range(10): Image= Image.open(imagelist[i]) Image=image.resize((128,128),Image.ANTIALIAS) Image=ImageTk.Photoimage(image) Label(window,image=image).pack() When i do like this there is only last one with the image othe nines labels are white blanked squres i cant realize whats the problem.please help me🙂

  • @dcdondon
    @dcdondon3 жыл бұрын

    Hi. Imagine that you have 300 photos to show. How would you load them with a for loop?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    in the same way you load one image

  • @luisbauer78
    @luisbauer783 жыл бұрын

    my python says that I don't have the PIL library do I have to do sth extra for that?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    yeah, from the terminal: pip install Pillow

  • @Bhartiya_Yoru
    @Bhartiya_Yoru4 жыл бұрын

    couldnt recursion be used to getthe next image?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Of course there are infinite ways to do anything...this is an intro course

  • @sriram.v.s5337
    @sriram.v.s53374 жыл бұрын

    Do you really have to put 'global my_label' at 9:55? Isn't it already global cuz its outside all the functions?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Try it and see

  • @bakiyakannan3746
    @bakiyakannan37463 жыл бұрын

    hi, When I try to execute the code on Jupyter notebook, I had an error with Lambda like invalid syntax.How Should I rectify the error?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Stop using Jupyter for tkinter

  • @Creek1575
    @Creek15754 жыл бұрын

    Sir, my root.quit() seems not working. Is this because of the ImageMagick viewer? If so, how could I fix this?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    No, there's likely a typo in your code. Did you put () brackets after quit in the code?

  • @Creek1575

    @Creek1575

    4 жыл бұрын

    @@Codemycom yes, idk why. I'm using my raspi 3B+. Just want to point out that before, my PIL image won't show and fixed it using ImageMagick, but since then "exit" commands for PIL doesn't close the window.

  • @Creek1575

    @Creek1575

    4 жыл бұрын

    @@Codemycom btw, great tut sir. I've used these codes for my image detection but my problem now is how to add loading screen while waiting for the result.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@Creek1575 ah...raspi is weird, you'll have to google it

  • @narmhabil

    @narmhabil

    3 жыл бұрын

    @@Creek1575 could you fix it? probably i have the same problem. I am waiting for result but any result isn't shown. and kernel restarts and my computer stops running

  • @Ty1er
    @Ty1er4 жыл бұрын

    ❤️❤️

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Thanks thanks!

  • @siddhantkadam4105
    @siddhantkadam41054 жыл бұрын

    @Codemy.com I would really appreciate if you answer my question. What are the dimensions of the imgaes you used? Why can't we use free size images and make them fit perfectly in the root window?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    I don't remember the sizes...not sure I understand your question.

  • @siddhantkadam4105

    @siddhantkadam4105

    4 жыл бұрын

    @@Codemycom I have 4-5 images clicked on a DSLR so the resolution is high. They don't fit into the root window we create. So need help with that.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@siddhantkadam4105 resize the images in photoshop or something

  • @siddhantkadam4105

    @siddhantkadam4105

    4 жыл бұрын

    @@Codemycom what is the maximum resolution of photos python accepts and displays properly in the root window?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@siddhantkadam4105 it depends on the monitor viewing it

  • @lakshayahlawat6674
    @lakshayahlawat66743 жыл бұрын

    IndexError: list index out of range this error is showing

  • @agrimpuriya2585
    @agrimpuriya25854 жыл бұрын

    Is it possible to lock the window size to a certain value so that it displays images of different sizes without changing the window shape?

  • @tarzano01

    @tarzano01

    4 жыл бұрын

    img1 = Image.open('name.jpg') img1 = img1.resize((300, 300), Image.ANTIALIAS) #height, width img1 = ImageTk.PhotoImage(img1)

  • @RamRam-217

    @RamRam-217

    4 жыл бұрын

    @@tarzano01 This does not work for me, when I click next image, the image view is not updated

  • @adityasagar9078

    @adityasagar9078

    3 жыл бұрын

    use this, root.geometry(900x900)

  • @user-zo4dn5sc1y
    @user-zo4dn5sc1y4 жыл бұрын

    How did you used back function with image_number parameter without giving it a parameter when you call it ?? (19:15 )

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    What do you mean....isn't the code there?

  • @abhilashakanthe618

    @abhilashakanthe618

    4 жыл бұрын

    @@Codemycom back() is not passed with any variable then how is button_back command executing in the forward function??

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@abhilashakanthe618 What do you mean?

  • @abhilashakanthe618

    @abhilashakanthe618

    4 жыл бұрын

    I am sorry js figured out my error. Thanks for your reply though. I love your teaching makes things looks so easy.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@abhilashakanthe618 Sorry, I'm not sure what you're talking about...the code is all in the video that shows it all.

  • @rahulraidas9481
    @rahulraidas94815 жыл бұрын

    Thanks sir. I love it. It's humble request to you can you upload some video's on python script to executable file . Py into . Exe please

  • @Codemycom

    @Codemycom

    5 жыл бұрын

    Sure thing...

  • @mujassimjamal24
    @mujassimjamal244 жыл бұрын

    Sir, why you used global variable, what its use?

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    To change the scope of the variable

  • @user-xh5bp6pj8j
    @user-xh5bp6pj8j4 ай бұрын

    Aspen is so cute, distracting me from coding 😂

  • @Codemycom

    @Codemycom

    4 ай бұрын

    HA, yesterday was her birthday!

  • @milli_the_ashawo
    @milli_the_ashawo3 жыл бұрын

    i keep getting this error line 26, in button_back = Button(root, text="

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Your back() function needs a variable in it... like def back(something):

  • @paninimafia4101
    @paninimafia41013 жыл бұрын

    Is there a way to make a WINDOW GRID 13x13 boxes, with inside each box an image viewer exactly the same as this? Is basically just this image viewer 196 times in 1 window (small of course). Thanks!

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    what's stopping you?

  • @paninimafia4101

    @paninimafia4101

    3 жыл бұрын

    @@Codemycom I dont know how.....

  • @paninimafia4101

    @paninimafia4101

    3 жыл бұрын

    @@Codemycom Any hint? Thanks!

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    @@paninimafia4101 Just do what we did in this video, but use frames...I have videos on frames. Use the grid system instead of pack to put them on the screen 13x13

  • @Harish-ou4dy
    @Harish-ou4dy4 жыл бұрын

    I have tried other ways of opening image like using img=image.Image("name.jpg"), but didn't work. If you could elaborate on how exactly the ImageTk.Photoimage is different from opening image in image module.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    Sorry dude, no idea what you're asking.

  • @Harish-ou4dy

    @Harish-ou4dy

    4 жыл бұрын

    @@Codemycom I tried: img=image.open("image_name.jpg") myLabel=Label(image=img) didnt work, couldnot figure out the role of PhotoImage command.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@Harish-ou4dy The role? Dude, you're way overthinking it...that's just how tk handles images.

  • @Harish-ou4dy

    @Harish-ou4dy

    4 жыл бұрын

    @@Codemycom Thanks, the calculator tutorial was very informative. In windows there was(and probably is) a program that opens all the images in the folder clicking next button, no need to specifically name few images in the program. I am attempting to make something like that. Could you shed some light on how it could be done? Uploading a tutorial on that will also be very awesome. But please consider sparing some hints.

  • @Codemycom

    @Codemycom

    4 жыл бұрын

    @@Harish-ou4dy These image videos do tell you how to do that...you should be able to figure it out from them.

  • @swaritacharya8765
    @swaritacharya87653 жыл бұрын

    Hello sir. I am a kid learning from your tutorials. You are doing an awesome job. I have understood every concept. I have a small doubt. What should be the size of the picture which is displayed?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Whatever size the image is...you can resize it using Pillow (I think I have videos on that in the playlist)

  • @swaritacharya8765

    @swaritacharya8765

    3 жыл бұрын

    Hi sir. It is giving an error. I will just put it up here. Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Anjaney\anaconda3\lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File ".\images.py", line 53, in button_front = Button(root, text = ">>", padx = 40, bg = "orange", command = lambda: forward(2)) File ".\images.py", line 33, in forward my_label = Label(image = image_list[image_number-1]) File "C:\Users\Anjaney\anaconda3\lib\tkinter\__init__.py", line 2766, in __init__ Widget.__init__(self, master, 'label', cnf, kw) File "C:\Users\Anjaney\anaconda3\lib\tkinter\__init__.py", line 2299, in __init__ (widgetName, self._w) + extra + self._options(cnf)) _tkinter.TclError: image "" doesn't exist Please help.

  • @swaritacharya8765

    @swaritacharya8765

    3 жыл бұрын

    Here is the code:- from tkinter import * from PIL import ImageTk, Image root = Tk() root.title("Test") my_img = Image.open("pics/baby (1).jpg") resized = my_img.resize((800, 800), Image.ANTIALIAS) new_pic = ImageTk.PhotoImage(resized) my_img_1 = Image.open("pics/baby (2).jpg") resized_1 = my_img_1.resize((800, 800), Image.ANTIALIAS) new_pic_1 = ImageTk.PhotoImage(resized_1) my_img_2 = Image.open("pics/baby (3).jpg") resized_2 = my_img_2.resize((800, 800), Image.ANTIALIAS) new_pic_2 = ImageTk.PhotoImage(resized_2) image_list = [my_img, my_img_1, my_img_2] my_label = Label(root, image=new_pic, height = 800, width=800) my_label.grid(row = 0, column = 0, columnspan = 3) def forward(image_number): global my_label global button_front global button_back my_label.grid_forget() my_label = Label(image = image_list[image_number-1]) button_front = Button(root, text = ">>", padx = 40, bg = "orange", command =lambda: forward(image_number+1)) button_back = Button(root, text = "

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    @@swaritacharya8765 try using image names that don't have spaces in them. baby (1).jpg change them to baby1.jpg. Also, I don't know what effect using Anaconda instead of regular python will have. You did pip install Pillow right?

  • @swaritacharya8765

    @swaritacharya8765

    3 жыл бұрын

    @@Codemycom Yes sir. I am using PowerShell Window

  • @tweetie6477
    @tweetie6477 Жыл бұрын

    I have a question sir, why do we have to update the buttons in the function?

  • @Codemycom

    @Codemycom

    Жыл бұрын

    otherwise they would show the same image every time you clicked them

  • @nghialuu2203
    @nghialuu22033 жыл бұрын

    I want to register now, can I use the coupon for total membership ?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    Go to the order form page at codemy.com and click the thing that says discount code, and type in the code.

  • @hellobro8837
    @hellobro88373 жыл бұрын

    What if someone have 1000 images, will he have to create thousand lines of codes just for this or there's any alternative way like for loop in the image folder?

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    yes, you could loop through..

  • @hellobro8837

    @hellobro8837

    3 жыл бұрын

    @@Codemycom can you show us the way because it's not in the program directly....

  • @riyapalkar1178
    @riyapalkar11783 жыл бұрын

    Plzs Do tell or share a link of how to open any image from directory without specifying its name in python code Tkinter., Plzs do tell 🙏

  • @Codemycom

    @Codemycom

    3 жыл бұрын

    I go over this in a bunch of videos on the playlist