示例#1
0
    def clientListe(self):

        windows = Tk()
        windows.title('P2P PROJECT')
        windows.geometry("750x750")
        text = Text(windows, height=50, width=100)

        text.configure(state='normal')
        if Data.is_connected():
            text.insert(CURRENT, "Connected to internet= YES\n")
        else:
            text.insert(CURRENT, "Connected to internet= NO\n")

        text.insert(CURRENT, "Numbers of users: " + str(len(Data.dict)) + "\n")
        text.insert(CURRENT, "My ip: " + str(Data.myip) + "\n")
        text.insert(CURRENT, "My name: " + str(Data.ID["Username"]) + "\n\n")

        for x, y in Data.dict.items():

            text.insert(
                CURRENT, "ip: " + str(x) + " Name: " + str(y[0]) +
                "       Last call : " + str(int(Data.get_sec() - y[1])) +
                " seconds " + "\n")

        text.insert(CURRENT,
                    "\nBlocked users: " + Data.Blockedusers() + "\n\n")
        text.configure(
            state='disabled')  # So the user can't write in the textbox
        text.pack()
        print(Data.get_time(), "[Interface] Main_Menu Interface ON")

        windows.mainloop()