How to display images in multiple canvas using tkinter library? [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to display images in multiple canvas using tkinter library? [Solved]

Here is the code for it ,which displays only second image and i don't really understand why so and how can i make it display both . Any help is much appreciated! https://code.sololearn.com/cA7DKZRfVB55/?ref=app

7th Jul 2021, 11:12 PM
Abhay
Abhay - avatar
3 Answers
+ 1
Greetings, Abhay . I've checked your code in editor. Try to uncomment each of these codes, and you'll see how it works. First one is rotating the image. Second one is not rotating. And most important is that you can't use same variable when you rotating the image. """ # This code for rotation of second image Img2=img.rotate(45) Img2=ImageTk.PhotoImage(Img2) canvas2.create_image(0,0, anchor=tk.NW,image=Img2) """ """ # This code for standard display of second image canvas2.create_image(0,0, anchor=tk.NW,image=Img) root.mainloop() """
10th Jul 2021, 5:59 PM
Maksat Ramazanov
Maksat Ramazanov - avatar
0
Maksat Ramazanov thanks a lot :) ! works absolutely well now .
10th Jul 2021, 6:19 PM
Abhay
Abhay - avatar
- 1
vishal kapur
12th Jul 2021, 1:35 AM
vishal dj Kumar
vishal dj Kumar - avatar