On Tue, Mar 19, 2019 at 4:55 AM Informatico de Neurodesarrollo
<infneurodcr....@infomed.sld.cu> wrote:
>
> This code work fine, every 5 second test the connection to this machine
> (10.44.0.15) on my network.
>
> def isInternet():
>      testConn = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
>      output = testConn.connect_ex(('10.44.0.15', 80))
>      if output == 0:
>          return True
>      else:
>          return False
>      testConn.close()
>
> while True:
>      if isInternet():
>          print("Hay conexión")
>      else:
>          print("No hay conexión")
>
>      time.sleep(5)
>
>
> What's next?, I am all eyes
>

Great! Now that that's working, you can go grab your Tkinter code
back. But you'll have to rework things. Set your networking code
aside, and just make something that, every five seconds, changes its
background colour. You may want to do some research on how to do that
reliably. Hint: you most likely won't have a "while" loop in your
final code.

Once you have both parts working separately, then you can put them
together, by having the background colour change be controlled by the
connection check. But first make sure that they work on their own.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to