Guest User

Untitled

a guest
Dec 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Exception in Tkinter callback
  2. Traceback (most recent call last):
  3. File "C:Python34libtkinter__init__.py", line 1482, in __call__
  4. return self.func(*args)
  5. File "C:UsersTAODesktopNewb.py", line 14, in imgs
  6. img = Image.open("C:\Users\TAO\Desktop\New\02.png")
  7. AttributeError: type object 'Image' has no attribute 'open'
  8.  
  9. from PIL import *
  10. import sqlite3
  11. from tkinter import *
  12.  
  13. connection = sqlite3.connect("school.db")
  14.  
  15. tao = Tk()
  16. tao.title("Mayurapada Central Collage")
  17. tao.configure(bg = '#6699ff')
  18. canvas = Canvas(tao,width = 600,height = 400,bg = '#6699ff')
  19.  
  20. def imgs():
  21.  
  22. img = Image.open("C:\Users\TAO\Desktop\New\02.png")
  23. img.show()
  24. str01 = "Image"
  25. font = ImageFont.truetype("arial.ttf",75)
  26. w,h = font.getsize(str01)
  27. print(str01)
  28.  
  29.  
  30. button01 = Button(tao,text = "Preview",bd = 7,padx = 5,pady = 5,command =
  31. imgs).place(x = 50,y = 300)
  32.  
  33. canvas.pack()
  34.  
  35. tao.mainloop()
Add Comment
Please, Sign In to add comment