Ejemplo n.º 1
0
def start_gui():
    (width, height) = (640, 480)
    root = Tk()
    canvas = Canvas(root, width=width, height=height)
    canvas.pack()
    root.resizable(width=FALSE, height=FALSE)
    class Struct(): pass
    canvas.data = Struct()
    canvas.data.width = width
    canvas.data.height= height
    canvas.data.root = root
    init(canvas)
    redrawAll(canvas)
    timerFired(canvas)
    canvas.data.root.mainloop()
def run(): # Main function that triggers the rest of the game
    root = Tk() # Initializes a new root
    root.resizable(width = FALSE, height = FALSE) # The canvas is not resizable
    root.title("Boggle - Aayush Tekriwal - (15-112 Term Project)") # Title
    (width, height) = (1000,600) # Width and height of 
    canvas = Canvas(root, width = width, height = height)
    canvas.pack()
    root.canvas = canvas.canvas = canvas
    class Struct: pass
    canvas.data = Struct() # Struct stores all data for global access
    canvas.data.width = width
    canvas.data.height = height
    initGame(root, canvas) 
    #root.bind("<Button-1>", printCoords) # Unhash to help modify graphics
    root.bind("<space >", lambda event: getWord(canvas, event))
    root.bind("<Return>", lambda event: getWord(canvas, event))
    root.mainloop()