don't work this: bg_fon2 = PhotoImage(file='2.GIF')

from tkinter import*
import random

root = Tk()
root.geometry("896x626")

canv = Canvas(root, height = 626, width = 896)

bg_fon = PhotoImage(file='fon.GIF')
canv.create_image(0,0,image=bg_fon,anchor='nw')

class Fish:
    image = 0
    coor = 0
    direct = 0
    real_img = 0
    obj = 0
    canv = 0
    def fiish1():
         canv2 = Canvas(root, height = 50, width = 50)
         bg_fon2 = PhotoImage(file='2.GIF')
         canv2.create_image(0,0,image=bg_fon2,anchor='nw')
         canv2.place(x=1,y=5)  
def zad_verhpr(event):
    Fish.fiish1()
root.bind("q",zad_verhpr)

canv.pack()
root.mainloop()

canv2.create_image(0,0,image=bg_fon2,anchor='nw')

don't work this: bg_fon2 = PhotoImage(file='2.GIF')

We have no idea what that means. Is it displaying upside down, or cropped, bad colors, etc.

To keep the image from being garbage-collected within the function scope, put this line canv2.image = bg_fon2 right after line 22

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.