import wx
import os
import re

def pingup(host='localhost'):
	try:
		ping = os.popen('ping -i .2 -c 5 -w 3 -W 3 %s' % host)
	except:
		return False
	
	res = ping.read()

	if re.match('.*100% packet loss.*(?s)', res) == None:
		return True
	

	return False
	


class statusPane(wx.Frame):
	def __init__(self):
		wx.Frame.__init__(self, -1, None)

class pingupper(wx.App):
	def OnInit(self):
		sp = statusPane()
		sp.Show(True)
		return True


if __name__ == '__main__':
	print pingup('magenta.zorcat.com')
	#pu = pingupper(None)
	#pu.MainLoop()

