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
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:
I appreciat if you help me and thank you for wasting your time seeing this! :)
1 |
button1 = Button(root , text = "Filter" , command = #[there the function def] |
There is what I tried to make:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
from tkinter import * from PIL import Image , ImageTk root = Tk() root.title( 'Program editare foto' ) image = ImageTk.PhotoImage(Image. open ( "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" ) button1.grid(row = 3 ,column = 0 ) button2.grid(row = 4 ,column = 0 ) button3.grid(row = 5 ,column = 0 ) button4.grid(row = 6 ,column = 0 ) button5.grid(row = 7 ,column = 0 ) button6.grid(row = 8 ,column = 0 ) root.mainloop() |