def main (): x = splashScreen() if x: # regular program inter = GraphicsInterface() app = PokerApp(inter) app.run()
d.setColor("black") if b == "Score": # Score clicked, ignore choices return [] elif choices != []: # Don't accept Roll unless some return choices # dice are actually selected def choose(self, choices): buttons = self.buttons # activate choice buttons, deactivate others for b in buttons: if b.getLabel() in choices: b.activate() else: b.deactivate() # get mouse clicks until an active button is clicked while True: p = self.win.getMouse() for b in buttons: if b.clicked(p): return b.getLabel() # function exit here. inter = GraphicsInterface() app = PokerApp(inter) app.run()
def main(): inter = TextInterface() app = PokerApp(inter) app.run()
from pokerapp import PokerApp class TextInterface: def __init__(self): print("Welcome to video poker.") def setMoney(self, amt): print("You currently have ${0}.".format(amt)) def setDice(self, values): print("Dice:", values) def wantToPlay(self): ans = input("Do you wish to try your luck? ") return ans[0] in "yY" def close(self): print("\nThanks for playing!") def showResult(self, msg, score): print("{0}. You win ${1}.".format(msg, score)) def chooseDice(self): return eval(input("Enter list of which to change ([] to stop) ")) inter = TextInterface() app = PokerApp(inter) app.run()
def main(): intro() # Build and execute app inter = GraphicsInterface() app = PokerApp(inter) app.run()
msg.setFill(c) msg.setOutline(o) msg.setSize(s) msg_shadow = ShadowText(msg, offset_x=2, offset_y=2) msg_shadow.draw(win) msg.draw(win) def get_response(self, win): """ Event loop to get response from user (clicking a button or pressing Return or Escape) :return: boolean -> True if OK is selected; otherwise False """ while True: p = win.checkMouse() k = win.checkKey() if p and self.button_ok.clicked(p) or k == "Return": win.close() return True if p and self.button_cancel.clicked(p) or k == "Escape": win.close() return False hi_scores = HighScore() # create HighScore object for application splash = SplashScreen(hi_scores) # display splash screen if splash.get_response(): inter = GraphicsInterface( hi_scores) # create interface object for application app = PokerApp(inter, hi_scores) # create app object app.run() # Play!
def main(): inter = GraphicsInterface() app = PokerApp(inter) app.run()
from pokerapp import PokerApp from Graphicsinterface import Graphicsinterface inter = Graphicsinterface() app = PokerApp(inter) app .run()