wxPython-questions (netstat)

Klaus Reinhardt K.Rdt at TU-Berlin.DE
Mon Jul 1 03:27:19 EDT 2002


---------------------------------------------------------------------
Hi

I have a wxPython-script which is monitoring 
netstat, but there are some questions:

1.) Is there a clearscreen option?
2.) Is there a gotoxy option?
3.) Why I have to have 2 windows?
4.) Can I have direct access to net-information?

tia		K at Rdt
---------------------------------------------------------------------


# vim:tw=78:ts=3:sw=3:
#********* So 30.06.02 17:45-1 ************** . . . . . . . . r 2 . p y w */
from wxPython.wx import *
from wxPython.lib.infoframe import *
import sys,os,thread
#============================================ . . . . . . . . . . . . . . */
class MyFrame(wxFrame):
	def __init__(self,output):
		wxFrame.__init__(self,None,-1,"Close me...",pos=(0,110),size=(300,100))

	   output.SetParent(self)

		EVT_CLOSE(self,self.OnClose)
		EVT_TIMER(self, -1, self.OnTimer)

		self.timer = wxTimer(self, -1)
		self.timer.Start(3000)

		self.save_stdout = sys.stdout
		sys.stdout = self.output = output

		self.icon = wxIcon('1_ast.ico', wxBITMAP_TYPE_ICO)
		self.SetIcon(self.icon)

	def OnClose(self,event):
		sys.stdout = self.save_stdout
		self.output.close()
		self.timer.Stop()
		self.timer = None
		self.Destroy()

	def OnTimer(self, evt):
		y=os.popen( 'netstat -a -n','r').read()
		print y
#============================================ . . . . . . . . . . . . . . */
class MyApp(wxApp):

	outputWindowClass = wxPyInformationalMessagesFrame

	def OnInit(self):
		frame = MyFrame(self.stdioWin)
		frame.Show(TRUE)
		self.SetTopWindow(frame)
		return true
#-------------------------------------------- . . . . . . . . . . . . . . */
app = MyApp(1)
app.MainLoop()
#********* So 30.06.02 17:45-1 ************** . . . . . . . . r 2 . p y w */








More information about the Python-list mailing list