summaryrefslogtreecommitdiff
path: root/netforge.py
blob: 3339f9602430f9cc11fc618603a724ee22bb275b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import tkinter as tk
import threading
import time

import scanner
from ui import UI


devices_cache = []


def scan_loop(ui):

    global devices_cache

    while True:
        devices_cache = scanner.scan_network()
        ui.update(devices_cache)

        time.sleep(5)


def main():

    root = tk.Tk()
    ui = UI(root)

    thread = threading.Thread(target=scan_loop, args=(ui,))
    thread.daemon = True
    thread.start()

    root.mainloop()


if __name__ == "__main__":
    main()