Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_Jpg2Canvas.py
- import Tkinter as tk
- from PIL import ImageTk, Image
- #This creates the main window of an application
- window = tk.Tk()
- window.title("JPG to Canvas")
- window.geometry("1800x1200")
- window.configure(background='grey')
- directory = 'C:\\Users\\test\\'
- filename = "ColorSpectrum.jpg"
- #Creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object.
- img = ImageTk.PhotoImage(Image.open(directory+filename))
- #The Label widget is a standard Tkinter widget used to display a text or image on the screen.
- panel = tk.Label(window, image = img)
- #The Pack geometry manager packs widgets in rows or columns.
- panel.pack(side = "bottom", fill = "both", expand = "yes")
- #Start the GUI
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement