def baseline():
    root=Tkinter.Toplevel()
    #root.geometry("730x450")
    root.title("Testing")
    img2 = ImageTk.PhotoImage(Image.open("efg.jpg"))
    w, h = img2.width(), img2.height() 
    canvas = Canvas(root, width=w , height=h)
    canvas.pack(fill = "both")
    canvas.create_image(0, 0, anchor=Tkinter.NW, image=img2)
    canvas.image = img2
    Tkinter.Button(root,text= "BASELINE RECORDING", width= 30, bg= "blue", fg= "white", command= testing).place(x=100, y=50)
    Tkinter.Button(root,text= "START TRAINING", width= 30, bg= "blue", fg= "white", command= EEG).place(x=100, y=100)
    Tkinter.Button(root, text= "GO BACK", width= 30, bg= "blue", fg= "white", command= nothing1).place(x=100, y= 150)
Example #2
0
def filter_pic(fname):
    # init image object
    img = IMG(fname)

    # transformations ##################
    img.colorShiftA()
    # img.cosNoise(200,30)
    img.sinePixelShift(5,
                       .5,
                       amp_stagger={
                           'b': 0,
                           'g': 10,
                           'r': 10
                       },
                       freq_stagger={
                           'b': 2,
                           'r': 2,
                           'g': 2
                       })
    img.rotate(180)
    img.sinePixelShift(5,
                       .5,
                       amp_stagger={
                           'b': 20,
                           'g': 10,
                           'r': 0
                       },
                       freq_stagger={
                           'b': 2,
                           'r': 2,
                           'g': 20
                       })
    img.rotate(180)
    # img.filterColor('r')
    #####################################

    # save image
    f = img.save_obj()
    #
    # #Create a canvas
    root = Tk()
    im = Image.open(f)
    canvas = Canvas(root, width=im.width, height=im.height)
    canvas.pack()
    # Put the image into a canvas compatible class, and stick in an
    # arbitrary variable to the garbage collector doesn't destroy it
    canvas.image = ImageTk.PhotoImage(im)
    # Add the image to the canvas, and set the anchor to the top left / north west corner
    canvas.create_image(0, 0, image=canvas.image, anchor='nw')
    raw_input('done')
   
root = Tk()

root.geometry("1024x800")
menu = Menu(root)
root.config(menu=menu)


subMenu = Menu(menu)
menu.add_cascade(label="File",menu=subMenu)

subMenu.add_command(label="New", command=nothing1)
subMenu.add_separator()
subMenu.add_command(label="Exit", command=ed)

viewMenu = Menu(menu)
menu.add_cascade(label="Testing", menu=viewMenu)
viewMenu.add_command(label="Add", command=baseline)

canvas = Canvas(root, width=1024 , height=768)
canvas.pack(fill="both")

rect1 = canvas.create_rectangle(0,0,1024,768, fill="pink")
img = ImageTk.PhotoImage(Image.open("abd.jpg"))
canvas.create_image(0, 0, anchor=Tkinter.NW, image=img)
canvas.image = img


root.mainloop()