def drawDynamicScene(canvas): # probably a whole different module cauldron = cauldron.Cauldron() cauldron.drawCauldron() if canvas.potionColor != None: cauldron.drawCauldronLiquid(canvas, canvas.potionColor) drawBottles(canvas) drawMeasuringCups(canvas) recipe = canvas.recipe recipe.checkRecipe(canvas, cauldron.inCauldron) recipe.displayProgress(canvas)
def leftMouseReleased(event): canvas = event.widget.canvas x, y = event.x, event.y currentBottles = canvas.currentBottles # list of potion bottles objects on the canvas currentCups = canvas.currentCups for cup in currentCups: (left, top, right, bottom) = cup.bounds if (x >= left) and (x<= right) and (y >= top) and (y<= bottom): cup.isSelected = False location = find(canvas, cup) cup.location = location if (location == "counter"): cup.onCounter = True canvas.cupOnCounter = cup canvas.onCounterCount +=1 elif (location == "cauldron") and (cup.isFull ==True): cauldron.addToCauldron(cup.info) cauldron.drawCauldronLiquid(cup.filledWith) redraw(canvas) canvas.cupOnCounter = None recipe = canvas.recipe recipe.checkRecipe(canvas, cauldron.inCauldron) recipe.displayProgress(canvas)