Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add Photo in Python
#5
(Nov-25-2018, 02:36 PM)snippsat Wrote: To make it more flexible so it support .png and .jpg,not all version on Tkinter dos this.
pip install pillow
Also do not use *,even if many dos use this in GUI programming.
import tkinter as tk
from PIL import ImageTk, Image

root = tk.Tk()
#photo = PhotoImage(file="blue.jpg")     #Nama file foto
photo = ImageTk.PhotoImage(Image.open("mu_logo.png"))
label = tk.Label(root, image=photo)
label.pack()
root.mainloop()

Thank you, this is the best Answer, :)
Reply


Messages In This Thread
Add Photo in Python - by adninqasifa - Nov-25-2018, 12:09 PM
RE: Add Photo in Python - by snippsat - Nov-25-2018, 12:56 PM
RE: Add Photo in Python - by adninqasifa - Nov-25-2018, 02:01 PM
RE: Add Photo in Python - by snippsat - Nov-25-2018, 02:36 PM
RE: Add Photo in Python - by adninqasifa - Nov-26-2018, 06:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  aoigram, pil Help with photo processing kolpac21 0 597 Aug-07-2023, 04:59 PM
Last Post: kolpac21
  [split] Python Pillow - Photo Manipulation keegan_010 1 3,000 Oct-11-2018, 09:57 AM
Last Post: Larz60+
  Python Pillow - Photo Manipulation keegan_010 2 2,944 Oct-11-2018, 03:49 AM
Last Post: keegan_010
  Closing an image opened by Pillow in Window Photo Viewer bigmit37 16 26,558 Aug-11-2017, 03:54 AM
Last Post: grahamnt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020