Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from PIL import ImageTk
- class Bird(object):
- def __init__(self, canvas, x=0, y=0):
- self.canvas = canvas
- photo = ImageTk.PhotoImage(file="flappy.gif")
- self.bird = self.canvas.create_image(x,y,image=photo)
- class Environment(Canvas):
- def __init__(self, master, width=500, height=500):
- super(Environment, self).__init__(master, width=width, height=height)
- self.pack()
- self.master = master
- self.bird = Bird(self)
- if __name__=="__main__":
- r = Tk()
- env = Environment(r)
- env.pack()
- r.mainloop()
- if __name__=="__main__":
- r,c=get_canv()
- c.pack()
- img = ImageTk.PhotoImage(file="flappy.gif")
- c.create_image(100,100,image=img)
- r.mainloop()
- if __name__=="__main__":
- r,c=get_canv()
- c.pack()
- c.create_image(100,100,image=ImageTk.PhotoImage(file="flappy.gif"))
- r.mainloop()
- self.photo = ImageTk.PhotoImage(file="flappy.gif")
- self.bird = self.canvas.create_image(x,y,image=self.photo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement