Skip to content

Commit

Permalink
IT WORKS! OMG IT DOES WHAT I WANT IT TO..mostly
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcs98 committed Nov 15, 2016
1 parent 613909f commit 7e84efe
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions mainFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
ImageBNum = 0
ImageAElo = 0
ImagebElo = 0
imageA = 0
imageB = 0


def makeResultsFile():
Expand Down Expand Up @@ -88,7 +90,7 @@ def randomImages():
while ImageANum == ImageBNum:
ImageANum = randint(0,NumberOfFiles-1)
def uglyELOWinnerA(event):
global ImageAElo, ImageBElo
global ImageAElo, ImageBElo, imageA, imageB
NewImageAElo, NewImageBElo = eloCalc(ImageAElo, ImageBElo, "ImageA")
print("WinnerA")

Expand All @@ -104,8 +106,33 @@ def uglyELOWinnerA(event):
ImageAElo = data[ImageANum][1]
ImageBElo = data[ImageBNum][1]

buttonforimageA = Button(root, text = "Better")
buttonforimageB = Button(root, text = "Better")


imageFileA = PIL.Image.open(data[ImageANum][0])
imageFileB = PIL.Image.open(data[ImageBNum][0])
imageFileA = imageFileA.resize((300,300))
imageFileB = imageFileB.resize((300,300))
photoA = PIL.ImageTk.PhotoImage(imageFileA)
photoB = PIL.ImageTk.PhotoImage(imageFileB)

imageA = Label(root, image=photoA)
imageB = Label(root, image=photoB)
imageA.image = photoA
imageB.image = photoB

buttonforimageA.bind("<Button-1>", uglyELOWinnerA)
buttonforimageB.bind("<Button-1>", uglyELOWinnerB)

imageA.grid(row=0,column=0)
imageB.grid(row=0,column=1)
buttonforimageA.grid(row=1,column=0)
buttonforimageB.grid(row=1,column=1)


def uglyELOWinnerB(event):
global ImageAElo, ImageBElo
global ImageAElo, ImageBElo, imageA, imageB
NewImageAElo, NewImageBElo = eloCalc(ImageAElo, ImageBElo, "ImageB")
print("WinnerB")

Expand All @@ -121,6 +148,33 @@ def uglyELOWinnerB(event):
ImageAElo = data[ImageANum][1]
ImageBElo = data[ImageBNum][1]

buttonforimageA = Button(root, text = "Better")
buttonforimageB = Button(root, text = "Better")


imageFileA = PIL.Image.open(data[ImageANum][0])
imageFileB = PIL.Image.open(data[ImageBNum][0])
imageFileA = imageFileA.resize((300,300))
imageFileB = imageFileB.resize((300,300))
photoA = PIL.ImageTk.PhotoImage(imageFileA)
photoB = PIL.ImageTk.PhotoImage(imageFileB)

imageA = Label(root, image=photoA)
imageB = Label(root, image=photoB)
imageA.image = photoA
imageB.image = photoB

buttonforimageA.bind("<Button-1>", uglyELOWinnerA)
buttonforimageB.bind("<Button-1>", uglyELOWinnerB)

imageA.grid(row=0,column=0)
imageB.grid(row=0,column=1)
buttonforimageA.grid(row=1,column=0)
buttonforimageB.grid(row=1,column=1)





if __name__ == '__main__':

Expand Down

0 comments on commit 7e84efe

Please sign in to comment.