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))
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
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)