Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import tkinter as tk
  2. from tkinter import PhotoImage
  3. from PIL import Image
  4.  
  5. root = tk.Tk()
  6. root.title('Pitch/Roll/Yaw Simulator')
  7.  
  8. # pick image file
  9. fname = "PRY_Diag_Dials.png"
  10. bg_image = tk.PhotoImage(file=fname)
  11.  
  12. # get the width and height of the image
  13. w = bg_image.width()
  14. h = bg_image.height()
  15.  
  16. # size the window so the image will fill it
  17. root.geometry("%dx%d+50+30" % (w, h))
  18. cv = tk.Canvas(width=w, height=h)
  19. cv.pack(side='top', fill='both', expand='yes')
  20. cv.create_image(0, 0, image=bg_image, anchor='nw')
  21.  
  22. # add canvas text
  23. cv.create_text(15, 20, text="Pitch/Roll/Yaw Simulator", fill="white", anchor='nw')
  24.  
  25. # add button widgets
  26. btn1 = tk.Button(cv, text="Initialise")
  27. btn1.pack(side='left', padx=10, pady=5, anchor='sw')
  28. btn2 = tk.Button(cv, text="Quit", command=root.destroy)
  29. btn2.pack(side='left', padx=10, pady=5, anchor='sw')
  30.  
  31. #add image labels
  32. pitch = tk.PhotoImage(file="Pitch.gif")
  33. w1 = tk.Label(cv, image=pitch).pack()
  34.  
  35. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement