Example #1
0
 def cleanup(self):
     self.player1 = self.e1.get()
     self.player2 = self.e2.get()
     self.player3 = self.e3.get()
     self.player4 = self.e4.get()
     self.players = [self.player1, self.player2, self.player3, self.player4]
     D.setup(self.players)
     self.top.destroy()
Example #2
0
 def get_text(self, P1Hitcount):
     P1Hitcount = tk.StringVar()
     P1Hitcount.set(
         D.count_actions(
             D.conn,
             D.PlayerName(D.conn,
                          D.assign_matchId(D.conn)[0],
                          D.positions[0])[0], "Hit")[0])
     self.after(1000, lambda: get_text(self, self.P1Hitcount))
     return P1Hitcount
Example #3
0
def get_text(root, P1Hitcount):
    root.P1Hitcount = tk.StringVar()
    root.P1Hitcount.set(
        D.count_actions(
            D.conn,
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0], D.positions[0])[0],
            "Hit")[0])
    print(root.P1Hitcount.get())
    root.after(1000, lambda: get_text(root, root.P1Hitcount))
Example #4
0
    def draw_names(self):
        self.playername = tk.StringVar(
            self)  #define the variable as a tk.string
        self.playername.set(
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0],
                         D.positions[0])[0])  #set the value for the variable
        self.Player1name = tk.Label(self, text=self.playername.get())
        self.Player1name.grid(row=0, column=1)

        self.playername.set(
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0],
                         D.positions[1])[0])  #set the value for the variable
        self.Player2name = tk.Label(self, text=self.playername.get())
        self.Player2name.grid(row=0, column=2)

        self.playername.set(
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0],
                         D.positions[2])[0])  #set the value for the variable
        self.Player3name = tk.Label(self, text=self.playername.get())
        self.Player3name.grid(row=0, column=3)

        self.playername.set(
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0],
                         D.positions[3])[0])  #set the value for the variable
        self.Player4name = tk.Label(self, text=self.playername.get())
        self.Player4name.grid(row=0, column=4)

        self.playername.set(D.assign_matchId(
            D.conn)[0])  #set the value for the variable
        self.Player4name = tk.Label(self,
                                    text="Match ID \n" + self.playername.get())
        self.Player4name.grid(row=1, column=0)
Example #5
0
 def Game_Over(self):
     D.game_over()
Example #6
0
    def player4_FR(self):

        D.player_hit(D.positions[3], D.stats[4])
Example #7
0
 def player3_FR(self):
     D.player_hit(D.positions[2], D.stats[4])
Example #8
0
 def player2_FR(self):
     D.player_hit(D.positions[1], D.stats[4])
Example #9
0
 def player1_FR(self):
     D.player_hit(D.positions[0], D.stats[4])
Example #10
0
 def setup(self):
     D.setup()
Example #11
0
 def player4_sink(self):
     D.player_hit(D.positions[3], D.stats[2])
Example #12
0
 def player4_save(self):
     D.player_hit(D.positions[3], D.stats[1])
Example #13
0
 def player3_hit(self):
     D.player_hit(D.positions[2], D.stats[0])
Example #14
0
 def player2_hit(self):
     D.player_hit(D.positions[1], D.stats[0])
Example #15
0
 def matchId(self):
     #database = os.getcwd() + "\Database.db"
     #conn = D.create_connection(database)
     matchid = D.assign_matchId(D.conn)
     print(matchid[0])
     return matchid[0]
Example #16
0
 def player4_ace(self):
     D.player_hit(D.positions[3], D.stats[3])
Example #17
0
    def cleanup(self):
        self.player1 = self.e1.get()
        self.player2 = self.e2.get()
        self.player3 = self.e3.get()
        self.player4 = self.e4.get()
        self.players = [self.player1, self.player2, self.player3, self.player4]
        D.setup(self.players)
        self.top.destroy()


root = tk.Tk()
root.geometry('600x300')
root.title('Dpong')
matchIdtext = tk.IntVar()
matchIdtext.set(D.assign_matchId(D.conn))
"""playername = tk.StringVar() #define the variable as a tk.string 
playername.set(D.PlayerName(D.conn, D.assign_matchId(D.conn)[0], D.positions[0])[0]) #set the value for the variable
Player1name = tk.Label(text=playername.get())
Player1name.grid(row=0,column=1)"""


def get_text(root, P1Hitcount):
    root.P1Hitcount = tk.StringVar()
    root.P1Hitcount.set(
        D.count_actions(
            D.conn,
            D.PlayerName(D.conn,
                         D.assign_matchId(D.conn)[0], D.positions[0])[0],
            "Hit")[0])
    print(root.P1Hitcount.get())