Hi
I´m trying to make a monitor that show when a host in my network goes offline, but I cant get it to loop the code and update the buttons in silence.
Now I has to exit and runt the script every time I want a update.
I want to put this up on a monitor that show it in real time, and maybe later I want some other information shown to.
I´m trying to make a monitor that show when a host in my network goes offline, but I cant get it to loop the code and update the buttons in silence.
Now I has to exit and runt the script every time I want a update.
I want to put this up on a monitor that show it in real time, and maybe later I want some other information shown to.
#GUI from tkinter import * class Application(Frame): """ GUI """ def __init__(self, master): """ Initialize the Frame""" Frame.__init__(self,master) self.grid() self.create_widgets() def create_widgets(self): """Create button. """ import os import subprocess #Router self.button1 = Button(self) self.button1["text"] = "Router" self.button1["fg"] = "white" self.button1.grid(row=0,column=5,rowspan=1,columnspan=2) #Ping hostname = "192.168.0.1" response = os.system("ping -n 1 " + hostname) #response if response == 0: self.button1["bg"] = "green" else: self.button1["bg"] = "red" root = Tk() root.title("monitor") root.geometry("500x500") app = Application(root) root.mainloop()