Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 [Tkinter] Image editor using Tkinter and PIL
Hello! I have to make a project , more exactly an Image Editor using python and I have very very basics information about libraries in python and python and I understood than I can make it using tkinter and PIL. Now my problem is with the PIL and tkinter putting together. I have a simple interface made with some buttons and I need to add some PIL filters or whatever "rotate" , "flip" , "crop" functions from PIL . I don't know how to put the command for the buttons from the filters that PIL library gives you , I tried to put like
 button1 = Button(root , text="Filter" , command=#[there the function def] 
but it won't let me make this and if you can suggest me some filters I will be thankful!
There is what I tried to make:
from tkinter import *
from PIL import Image , ImageTk

root = Tk()
root.title('Program editare foto')
image = ImageTk.PhotoImage("imagini/imag1.jpg"))

my_label = Label(image=image)
my_label.grid(row=1 , column=1 , columnspan=2)
my_label1 = Label(text=" ")
my_label2 = Label(text=" ")

my_label1.grid(row=0 ,column=0)
my_label2.grid(row=1 ,column=0)

button1 = Button(root , text="Filter1")
button2 = Button(root , text="Filter2")
button3 = Button(root , text="Filter3")
button4 = Button(root , text="Filter4")
button5 = Button(root , text="Filter5")
button6 = Button(root, text="Filter6")


I appreciat if you help me and thank you for wasting your time seeing this! :)
Quote:I have very very basics information about libraries in python
see: and python docs
you need a function check out :
tkinter button
it's also referred as a callback, if you add a command you need a function for it.
and it must be declared before you create your button.
def my_callback():
    print('filter button pushed')
button1 = Button(root , text="Filter" , command=my_callback)
I suggest using guizero to start with lawsie has recipes and documentation here:
guizero documentation

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Scrollable big image in a window (TKinter) Prospekteur 3 104 Sep-14-2020, 03:06 AM
Last Post: Larz60+
  Adding an image to a tkinter window djwilson0495 2 328 Aug-23-2020, 11:07 AM
Last Post: ebolisa
  Create image on a Toplevel using tkinter ViktorWong 3 1,420 Jun-13-2020, 03:21 PM
Last Post: deanhystad
  [Tkinter] Indentation for Tkinter-made Text Editor ShakeyPakey 4 415 Jun-08-2020, 03:13 PM
Last Post: menator01
  [Tkinter] Tkinter Logo Image Evil_Patrick 1 466 May-25-2020, 05:12 AM
Last Post: DT2000
  tkinter and image paths menator01 2 323 Apr-14-2020, 08:46 PM
Last Post: menator01
  Unable to put background image on Tkinter Frame jenkins43 2 4,007 Nov-27-2019, 11:38 AM
Last Post: jenkins43
  Zooming a tkinter image GalaxyCoyote 2 2,589 Nov-09-2019, 04:36 PM
Last Post: GalaxyCoyote
  Can't load a png image tkinter Pythenx 2 3,709 May-04-2019, 05:43 PM
Last Post: woooee
  how to insert image into Text widget Tkinter atlass218 5 3,947 Apr-17-2019, 05:28 AM
Last Post: atlass218

Forum Jump:

Users browsing this thread: 1 Guest(s)