GUI in python programing
<p>the fallowing is a tic tak toe game code in python, can some one show me how i can make it in GUI form with a reset option and shows who wins at the end. like X win or O win?</p>

<p>board = " 1 | 2 | 3\n-----------\n 4 | 5 | 6\n-----------\n 7 | 8 | 9"</p>

<p>. 
checkboard=[1,2,3,4,5,6,7,8,9,1,4,7,2,5,8,3,6,9,1,5,9,3,5,7]</p>

<p>spaces=range(1,10)</p>

<p>def moveHandler(board,spaces,checkboard,player,n):</p>

<pre><code>if player==1:
    check="X"
else:   
    check="O"

while spaces.count(n)==0:
    print "\nInvalid Space"
    n=playerinput(player)

spaces=spaces.remove(n)

board=board.replace(str(n),check)

for c in range(len(checkboard)):
    if checkboard[c]==n:
        checkboard[c]=check


status = checkwinner(checkboard,check)
return board,status
</code></pre>

<p>def checkwinner(checkboard,check):
    a,b,c=0,1,2</p>

<pre><code>while a&lt;=21:
    combo = [checkboard[a],checkboard[b],checkboard[c]]

    if combo.count(check) == 3:
        status =1
        break
    else:
        status =0

    a+=3
    b+=3
    c+=3

return status
</code></pre>

<p>def  playerinput(player):
    try:
        key = int(raw_input('\n\nPlayer ' + str(player) + ': Please select a space '))</p>

<pre><code>except ValueError:

    print "Invalid Space"

    key = playerinput(player)

return key
</code></pre>

<p>while True:</p>

<pre><code>player = len(spaces)%2 +1

if player == 1:

    player = 2

else:

    player =1

print "\n\n" + board

key = playerinput(player)

board,status =moveHandler(board,spaces,checkboard,player,key)

if status == 1:

    print '\n\nPlayer ' + str(player) + ' is the winner!!!'

    print board

    break

elif len(spaces)==0:

    print "No more spaces left. Game ends in a TIE!!!"


    print board

    break

else:

    continue
</code></pre>
