Exemplo n.º 1
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self,
                                     text="Search Opponent Name",
                                     font="times",
                                     fontsize=14,
                                     fontweight="bold")
        header.pack(padx=10, pady=10)

        # name input and search button
        usernameEntry = widgets.createEntry(self, bgcolor="beige")
        usernameEntry.pack(pady=10)
        challengeButton = widgets.createButton(
            self,
            function=lambda: self.challenge(controller, usernameEntry.get()),
            text="Challenge",
            bgcolor="sky blue")
        challengeButton.pack(pady=10)

        # return to main menu
        returnButton = widgets.createButton(
            self,
            function=lambda: controller.show_frame(MainMenuPage),
            text="Return to Main Menu",
            bgcolor="sky blue")
        returnButton.pack(pady=10)
Exemplo n.º 2
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self, text="Sign in to LiChess", font="times", fontsize=14, fontweight="bold")
        header.pack(padx=10, pady=10)

        """ username/password entries
        usernameLabel = widgets.createLabel(self, text="Username", font="times", fontsize=11, fontweight="normal")
        usernameLabel.pack()
        usernameEntry = widgets.createEntry(self, bgcolor="beige")
        usernameEntry.pack()

        passwordLabel = widgets.createLabel(self, text="Password", font="times", fontsize=11, fontweight="normal")
        passwordLabel.pack()
        passwordEntry = widgets.createEntry(self, bgcolor="beige", show="*")
        passwordEntry.pack()
        """

        """ buttons """
        loginButton = widgets.createButton(self, function=lambda: self.submit(controller=controller, username=app_username),
        text="Login as "+app_username, bgcolor="seashell3")
        loginButton.pack(pady=4)

        returnButton = widgets.createButton(self, function=lambda: controller.show_frame(StartupPage),
        text="Return", bgcolor="seashell3")
        returnButton.pack(pady=7)
Exemplo n.º 3
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)

        # create frame for scrollbar
        sb_frame = tk.Frame(self)
        sb = widgets.createScrollbar(sb_frame)
        sb_frame.pack()

        # find past 25 games (completed), put them in listbox, and put listbox in scrollbar
        games = interface.get_all_games()
        gamelist = widgets.createListbox(sb_frame, width=100, yscrollcommand=sb.set)
        sb.config(command=gamelist.yview)
        sb.pack(side='right', fill='y')
        # make an entry for each game
        for game in games:
            # get date and time of game
            date_object = time.gmtime(int(game['time'])/1000.)
            date = time.strftime('%m/%d/%Y %H:%M', date_object)

            gamelist.insert('end', game["gameid"]+" ~ White: "+game["white"]+" ~ Black: "+game["black"]+" ~ Date: "+date)
        gamelist.pack(pady=10)

        widgets.createButton(self, function=lambda: self.replay(controller, gamelist.get(gamelist.curselection())), 
                            text="Replay your previous game", bgcolor="sky blue").pack(pady=10)

        # widgets.createButton(self, function=lambda: self.refresh(controller), text="Refresh", bgcolor="gray").pack(pady=10)

        returnButton = widgets.createButton(self, function=lambda: controller.show_frame(ReplayGamePage),
                                                text="Return", bgcolor="sky blue")
        returnButton.pack(pady=10)
Exemplo n.º 4
0
    def menuButtons(self, controller):
        """ main menu options """
        playbotButton = widgets.createButton(
            self,
            function=lambda: controller.show_frame(PlayBotPage),
            text="Play Bot",
            bgcolor="sky blue")
        playbotButton.pack(pady=5)

        playrandButton = widgets.createButton(
            self,
            function=lambda: controller.show_frame(PlayRandomPage),
            text="Seek an Opponent",
            bgcolor="sky blue")
        playrandButton.pack(pady=5)

        playfriendButton = widgets.createButton(
            self,
            function=lambda: controller.show_frame(ChallengePage),
            text="Challenge a Friend",
            bgcolor="sky blue")
        playfriendButton.pack(pady=5)

        exitButton = widgets.createButton(self,
                                          function=quit_program,
                                          text="Exit MagiChess",
                                          bgcolor="seashell3")
        exitButton.pack(pady=5)
Exemplo n.º 5
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self, text="MagiChess", font="times", fontsize=25, fontweight="bold")
        header.pack(padx=10, pady=10)

        #startup buttons
        signinButton = widgets.createButton(self, function=lambda: controller.show_frame(SigninPage),
                                text="Sign in to LiChess.org", bgcolor="sky blue")
        signinButton.pack(pady=10)

        exitButton = widgets.createButton(self, function=quit_program,
                                text="Exit", bgcolor="seashell3")    
        exitButton.pack()
Exemplo n.º 6
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self, text="Want to replay a game? Input the Game ID", font="times", fontsize=14, fontweight="bold")
        header.pack(padx=10, pady=10)

        # game id entry box
        idEntry = keyboard.KeyboardEntry(self)
        idEntry.pack(pady=10)

        widgets.createButton(self, function=lambda: self.replay(controller, idEntry.get()), 
                            text="Replay with Gameid", bgcolor="sky blue").pack(pady=10)
        widgets.createButton(self, function=lambda: controller.show_frame(PreviousGamesPage),
                            text="View your previous games", bgcolor="sky blue").pack(pady=10)
        
        returnButton = widgets.createButton(self, function=lambda: controller.show_frame(MainMenuPage),
                                                text="Return", bgcolor="sky blue")
        returnButton.pack(pady=10)
Exemplo n.º 7
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self, text="Challenge has been declined or timed out (10s)", font="times", fontsize=14, fontweight="bold")
        header.pack(padx=10, pady=10)

        returnButton = widgets.createButton(self, function=lambda: controller.show_frame(ChallengePage),
                                             text="Return", bgcolor="sky blue")
        returnButton.pack(pady=10)
Exemplo n.º 8
0
 def __init__(self, master, controller):
     tk.Frame.__init__(self, master)
     header = widgets.createLabel(self, text="Seeking Opponent...", font="times", fontsize=14, fontweight="bold")
     header.pack(padx=10, pady=10)
     
     #return to main menu
     returnButton = widgets.createButton(self, function=lambda: controller.show_frame(MainMenuPage),
                                         text="Return to Main Menu", bgcolor="sky blue")
     returnButton.pack()
Exemplo n.º 9
0
    def __init__(self, master, controller):
        tk.Frame.__init__(self, master)
        header = widgets.createLabel(self, text="Search Opponent Name", font="times", fontsize=14, fontweight="bold")
        header.pack(padx=10, pady=10)

        # name input
        usernameEntry = keyboard.KeyboardEntry(self) 
        usernameEntry.pack(pady=10)

         # provide options for starting color
        userColor = tk.StringVar(value="1")
        widgets.createRadioButton(self, "Random", userColor, "random").pack()
        widgets.createRadioButton(self, "White", userColor, "white").pack()
        widgets.createRadioButton(self, "Black", userColor, "black").pack()

        # challenge button
        challengeButton = widgets.createButton(self, function=lambda: self.challenge(controller, userColor.get(), usernameEntry.get()),
                                                text="Challenge", bgcolor="sky blue")
        challengeButton.pack(pady=10)

        # return to main menu
        returnButton = widgets.createButton(self, function=lambda: controller.show_frame(MainMenuPage),
                                            text="Return to Main Menu", bgcolor="sky blue")
        returnButton.pack(pady=10)