Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- from tkinter import *
- def check(player , computer):
- if selection[player] == computer:
- print("Tie")
- elif computer == selection[(player-1)%6] or computer == selection[(player+2)%6]:
- print("You win!",selection[player],"beats",computer)
- else:
- print("You lose!",computer,"beats",selection[player])
- def main(player):
- value = selection.index(player)
- computer = selection[randint(0,5)]
- check(value , computer)
- def GUI():
- window = Tk()
- window.title("Rock , paper , sissors , spock , lizard , eLF")
- label = Label(window,text="Click on Rock , paper , Scissors , Spock , Lizard or magical eLF")
- label.pack()
- topframe = Frame(window)
- topframe.pack(side=TOP)
- bottomframe = Frame(window)
- bottomframe.pack(side=BOTTOM)
- rock = Button(topframe, text="Rock", fg="red",command= lambda: main("rock"))
- paper = Button(topframe, text="paper", fg="blue",command= lambda: main("paper"))
- scissor = Button(topframe, text="scissor", fg="green",command= lambda: main("scissors"))
- spock = Button(bottomframe, text="Spock", fg="purple",command= lambda: main("spock"))
- lizard =Button(bottomframe, text="lizard", fg="yellow",command= lambda: main("lizard"))
- eLF = Button(bottomframe, text="eLF", fg="aqua",command= lambda: main("eLF"))
- rock.pack(side=LEFT)
- paper.pack(side=LEFT)
- scissor.pack(side=LEFT)
- spock.pack(side=LEFT)
- lizard.pack(side=LEFT)
- eLF.pack(side=RIGHT)
- window.mainloop()
- #Globals
- selection = ["rock","paper","scissors","spock","lizard","eLF"]
- GUI()
Advertisement
Add Comment
Please, Sign In to add comment