Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import PhotoImage
- from PIL import Image
- root = tk.Tk()
- root.title('Pitch/Roll/Yaw Simulator')
- # pick image file
- fname = "PRY_Diag_Dials.png"
- bg_image = tk.PhotoImage(file=fname)
- # get the width and height of the image
- w = bg_image.width()
- h = bg_image.height()
- # size the window so the image will fill it
- root.geometry("%dx%d+50+30" % (w, h))
- cv = tk.Canvas(width=w, height=h)
- cv.pack(side='top', fill='both', expand='yes')
- cv.create_image(0, 0, image=bg_image, anchor='nw')
- # add canvas text
- cv.create_text(15, 20, text="Pitch/Roll/Yaw Simulator", fill="white", anchor='nw')
- # add button widgets
- btn1 = tk.Button(cv, text="Initialise")
- btn1.pack(side='left', padx=10, pady=5, anchor='sw')
- btn2 = tk.Button(cv, text="Quit", command=root.destroy)
- btn2.pack(side='left', padx=10, pady=5, anchor='sw')
- #add image labels
- pitch = tk.PhotoImage(file="Pitch.gif")
- w1 = tk.Label(cv, image=pitch).pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement