I am checking the internet connectivity on GUI button press and reading the status value to process other internet dependent Tasks.
Issue : The screen become unresponsive until the instatus thread is finished.
I want the GUI to read the Internet status parallel to Screen function and store the status in a variable but I believe the join method blocks the code until I receive the output. If anyone can help me out with this problem, It would be greatly appreciated.Thanks in advance.
Internet connection checking python script :
import socket
def is_connected(hostname):
  try:
    # connect to the host -- tells us if the host is actually
    # reachable
    s = socket.create_connection((hostname, 80), 2)
    if s is not None:
        s.close()
    return True
  except:
     pass
  return False
Main Program code snippet :
def CheckRoutine(root):
    global PageTimer
    global mainScreen
    global SecScreenClick
    global optionSelect
    optionSelect = 0
    if SecScreenClick == False:
        SecScreenClick = True
        mainScreen = root
        if initScroller is not None:
                root.after_cancel(initScroller)
        root.withdraw()
        timeCount = 0
        optionSelect = 0
        endRecycleCount = False
        master1 = tk.Toplevel()
        master1.attributes('-fullscreen', True)
        lblBackground = Label(master1, width=ws, height=hs, image=BGEngS2)
        lblBackground.photo = BGEngS2
        lblBackground.pack(fill=BOTH, expand=YES)
        operatorButton = tk.Button(lblBackground, highlightthickness=0, bd=0, borderwidth=0, image=OpLoginS2, command=lambda : winRecycling(master1, 4, backThr))
        operatorButton.image = OpLoginS2
        operatorButton.place(x = 20, y = 670)
        engButton = tk.Button(lblBackground, highlightthickness=0, bd=0, borderwidth=0, image=langEngS2, command=lambda : winRecycling(master1, 1, backThr))
        engButton.image = langEngS2
        engButton.place(x=950, y=20)
        hindiButton = tk.Button(lblBackground, highlightthickness=0, bd=0, borderwidth=0, image=langHindiS2, command=lambda : winRecycling(master1, 2, backThr))
        hindiButton.image = langHindiS2
        hindiButton.place(x=950, y=397)
        PageTimer = Label(lblBackground, width=10, height=2, font=('Times', 20, 'bold'), bg='white')
        PageTimer.place(x=95, y=15)
        settings.timerStatus = 1
        cdTimer.screenTimer(PageTimer, 0, 20)
        backThr = master1.after(20000, lambda: backRoutine(master1, mainScreen))
        master1.after(300, lambda : InternetStatus_Check())
        master1.mainloop()
        return
def InternetStatus_Check():
        global internetCheck_flag
        inStatus = threading.Thread(target=lambda q, arg1: q.put(internetCheck.is_connected(arg1)),args=(que, '1.1.1.1'))
        inStatus.start()
        inStatus.join()
        internetCheck_flag = que.get()
        print internetCheck_flag
   
Button1= tk.Button(MainScreen, image=start_image, highlightthickness=0, borderwidth=2, relief="raised", command=lambda : CheckRoutine(root))
Button1.image = start_image
Button1.place(x=980, y=45)
