Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Update tic-tac-toe.py #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Python/Python_Games/tic-tac-toe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

# In[5]:

print("---------------------------------------")
print("Welcome to tic tac toe")
print("---------------------------------------")
name1=input("Player 1 name:")
name2=input("Player 2 name:")

from tkinter import *
import tkinter.messagebox
tk = Tk()
tk.title("Tic Tac Toe")
tk.title("Tic Tac Toe game")

pa = StringVar()
playerb = StringVar()
Expand Down Expand Up @@ -54,7 +59,7 @@ def btnClick(bs):
checkForWin()
flag += 1
else:
tkinter.messagebox.showinfo("Tic-Tac-Toe", "Button already Clicked!")
tkinter.messagebox.showinfo("Tic-Tac-Toe", "Button has been already Clicked!")

def checkForWin():
if (b1['text'] == 'X' and b2['text'] == 'X' and b3['text'] == 'X' or
Expand All @@ -70,7 +75,7 @@ def checkForWin():
tkinter.messagebox.showinfo("Tic-Tac-Toe", pa)

elif(flag == 8):
tkinter.messagebox.showinfo("Tic-Tac-Toe", "It is a Tie")
tkinter.messagebox.showinfo("Tic-Tac-Toe", "No winner, there is a tie")

elif (b1['text'] == 'O' and b2['text'] == 'O' and b3['text'] == 'O' or
b4['text'] == 'O' and b5['text'] == 'O' and b6['text'] == 'O' or
Expand Down