예제 #1
0
def run_game():
    JottoModel.loadWords("kwords5.txt")
    makeMenus()  
    for row in range(0,20):
        makeBox(row,0)
    
    Tkinter.mainloop()
예제 #2
0
def newGame():
    JottoModel.startGame()
    global currentIndex
    currentIndex = 0
    for index in range(len(entryList)):
        entry = entryList[index]
        box = spinList[index]
        button = buttonList[index]
    #for entry,box in zip(entryList,spinList):
        entry.delete(0,Tkinter.END)
        box.selection_clear()
        box.config(values=(0,1,2,3,4,5,6),state=Tkinter.DISABLED)
        button.config(state=Tkinter.DISABLED)
    displayGuess()
예제 #3
0
def displayGuess():
    global entryList,currentIndex,lastGuess
    word = JottoModel.getGuess()
    lastGuess = word
    entryList[currentIndex].insert(0,word)
    spinList[currentIndex].config(state=Tkinter.NORMAL)
    buttonList[currentIndex].config(state=Tkinter.NORMAL)
    if currentIndex > 0:
        buttonList[currentIndex-1].config(state=Tkinter.DISABLED)
    currentIndex += 1
예제 #4
0
def processCount(count):
    global lastGuess
    count = int(count)
    if count == 6:
        showVictory()
    else:
        numLeft = JottoModel.processCommon(lastGuess,count)
        print "number of words left is ",numLeft
        if numLeft == 0:
            show_nowords()
        else:
            displayGuess()
예제 #5
0
def showVictory():
    st = "I have won the game.\n"+\
         "I guessed your word!\n"+\
         "# guesses = "+str(JottoModel.guessCount())
    tkMessageBox.showinfo("Duke Jotto",st)
    disable()