Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. from tkinter import *
  2. from PIL import ImageTk
  3.  
  4. class Bird(object):
  5. def __init__(self, canvas, x=0, y=0):
  6. self.canvas = canvas
  7. photo = ImageTk.PhotoImage(file="flappy.gif")
  8. self.bird = self.canvas.create_image(x,y,image=photo)
  9.  
  10. class Environment(Canvas):
  11. def __init__(self, master, width=500, height=500):
  12. super(Environment, self).__init__(master, width=width, height=height)
  13. self.pack()
  14. self.master = master
  15. self.bird = Bird(self)
  16.  
  17. if __name__=="__main__":
  18. r = Tk()
  19. env = Environment(r)
  20. env.pack()
  21. r.mainloop()
  22.  
  23. if __name__=="__main__":
  24. r,c=get_canv()
  25. c.pack()
  26. img = ImageTk.PhotoImage(file="flappy.gif")
  27. c.create_image(100,100,image=img)
  28. r.mainloop()
  29.  
  30. if __name__=="__main__":
  31. r,c=get_canv()
  32. c.pack()
  33. c.create_image(100,100,image=ImageTk.PhotoImage(file="flappy.gif"))
  34. r.mainloop()
  35.  
  36. self.photo = ImageTk.PhotoImage(file="flappy.gif")
  37. self.bird = self.canvas.create_image(x,y,image=self.photo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement