Komplett überarbeitet
messagebox gegen label ausgetauscht man sieht was man selber/gegenspieler gewählt hat
This commit is contained in:
parent
ee6e96d91a
commit
50ca9d1707
42
GUI.py
42
GUI.py
@ -1,7 +1,7 @@
|
||||
from tkinter import *
|
||||
from tkinter import messagebox
|
||||
root = Tk()
|
||||
root.geometry("850x300")
|
||||
root.geometry("900x900")
|
||||
|
||||
punkte1 = 0
|
||||
punkte2 = 0
|
||||
@ -12,30 +12,52 @@ def ok():
|
||||
s2=s2_wert.get()
|
||||
|
||||
if s1 == s2:
|
||||
messagebox.showinfo("unentschieden",f"Unentschieden")
|
||||
Label(root, text="Unentschieden",font=("times",25)).grid(row=6, column=1)
|
||||
|
||||
elif s1 == "s" and s2 == "p" or s1 == "p" and s2 == "r" or s1 == "r" and s2 == "s":
|
||||
global punkte1
|
||||
punkte1 += 1
|
||||
messagebox.showinfo("Gewinner",f"Spieler 1 hat gewonnen und hat: {punkte1} Punkte")
|
||||
|
||||
Label(root, text="Spieler 1 Gewinnt", font=("times",25)).grid(row=6, column=1)
|
||||
Label(root, text="Punkte: ", font=("times",25)).grid(row=8)
|
||||
Label(root, text=punkte1, font=("times",25)).grid(row=9)
|
||||
if s1 == "s" and s2 == "p":
|
||||
Label(root,text="wählt Schere", font=("times", 25)).grid(row=6)
|
||||
Label(root,text="wählt Papier", font=("times", 25)).grid(row=6, column=2)
|
||||
elif s1 == "p" and s2 == "r":
|
||||
Label(root,text="wählt Papier", font=("times", 25)).grid(row=6)
|
||||
Label(root,text=" wählt Stein ", font=("times", 25)).grid(row=6, column=2)
|
||||
elif s1 == "r" and s2 == "s":
|
||||
Label(root,text=" wählt Stein ", font=("times", 25)).grid(row=6)
|
||||
Label(root,text="wählt Schere", font=("times", 25)).grid(row=6, column=2)
|
||||
|
||||
else:
|
||||
global punkte2
|
||||
punkte2 += 1
|
||||
messagebox.showinfo("Gewinner",f"Spieler 2 hat gewonnenund hat: {punkte2} Punkte")
|
||||
|
||||
|
||||
Label(root, text="Spieler 2 Gewinnt", font=("times", 25)).grid(row=6, column=1)
|
||||
Label(root, text="Punkte:", font=("times",25)).grid(row=8, column=2)
|
||||
Label(root, text=punkte2, font=("times",25)).grid(row=9, column=2)
|
||||
if s2 == "r" and s1 == "s":
|
||||
Label(root,text=" wählt Schere ", font=("times", 25)).grid(row=6)
|
||||
Label(root,text=" wählt Stein ", font=("times", 25)).grid(row=6, column=2)
|
||||
elif s2 == "s" and s1 == "p":
|
||||
Label(root,text=" wählt Papier", font=("times", 25)).grid(row=6)
|
||||
Label(root,text="wählt Schere", font=("times", 25)).grid(row=6, column=2)
|
||||
elif s2 == "p" and s1 == "r":
|
||||
Label(root,text="wählt Papier", font=("times", 25)).grid(row=6)
|
||||
Label(root,text=" wählt Stein ", font=("times", 25)).grid(row=6, column=2)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Label(root, text="S = Schere, R = Stein, P = Papier ", font=("times",25)).grid(column=1)
|
||||
Label(root, text="S = Schere, R = Stein, P = Papier ", font=("times",25)).grid(column=1)
|
||||
Label(root, text="Spieler 1", font=("times", 25)).grid(row=1)
|
||||
Label(root, text="Spieler 2", font=("times", 25)).grid(row=1, column=2)
|
||||
|
||||
s1_wert = Entry(root,font=(28), show="*")
|
||||
s1_wert.grid(row=1)
|
||||
s1_wert.grid(row=3)
|
||||
s2_wert = Entry(root,font=(28), show="*")
|
||||
s2_wert.grid(row=1,column=2)
|
||||
s2_wert.grid(row=3,column=2)
|
||||
|
||||
Button(root, text="Wählen", command=ok, font=(30)).grid(row=2, column=1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user