Beispiel #1
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))
Beispiel #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
Beispiel #3
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)
Beispiel #4
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]
Beispiel #5
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())