Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. import tkinter as tk
  2. root = tk.Tk()
  3. root.geometry("960x687")
  4. root.resizable(0, 0)
  5. root.title("Body Parts")
  6. root.config(background="white")
  7.  
  8. skeleton = tk.PhotoImage(file="skele.gif")
  9. tk.Label(root, image=skeleton, width=303, height=662).place(x=10, y=10)
  10.  
  11. parts = ["skull", "jaw", "shoulder", "upperarm", "spine", "rib", "lowerarmhigh", "lowerarmlow", "tailbone", "hip", "pelvic", "upperleg", "lowerleghigh", "lowerleglow", "knee"]
  12.  
  13. button = tk.PhotoImage(file="button.gif")
  14. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(0, info)).place(x=159, y=38)
  15. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(1, info)).place(x=159, y=98)
  16. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(2, info)).place(x=196, y=135)
  17. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(3, info)).place(x=225, y=176)
  18. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(4, info)).place(x=159, y=189)
  19. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(5, info)).place(x=184, y=200)
  20. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(6, info)).place(x=75, y=270)
  21. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(7, info)).place(x=56, y=301)
  22. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(8, info)).place(x=159, y=297)
  23. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(9, info)).place(x=189, y=280)
  24. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(10, info)).place(x=159, y=326)
  25. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(11, info)).place(x=119, y=407)
  26. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(12, info)).place(x=119, y=518)
  27. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(13, info)).place(x=133, y=548)
  28. tk.Button(root, image=button, width=5, height=5, bg="#C1D5B4", command=lambda:show(14, info)).place(x=187, y=459)
  29.  
  30. infoImage = tk.PhotoImage(file="skull.gif")
  31. info = tk.Label(root, image=infoImage, width=620, height=620)
  32. info.place(x=323, y=30)
  33.  
  34. def show(num, info):
  35. imgName = parts[num] + ".gif"
  36. print("Showing:", imgName)
  37. img = tk.PhotoImage(file=imgName)
  38. info.config(image=img)
  39. info.image = img
  40.  
  41. def leave():
  42. root.destroy()
  43. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement