HT clear some wxPython fram?

Klaus Reinhardt K.Rdt at TU-Berlin.DE
Wed Jul 3 12:42:56 EDT 2002


Am 03.07.02 18:22:45, schrieb Vadim Zeitlin <zeitlin at seth.lpthe.jussieu.fr>:

>On Wed, 03 Jul 2002 17:05:02 +0200, Klaus Reinhardt <K.Rdt at TU-Berlin.DE> wrote:
>> HOW I CAN CLEAR SOME FRAME?
>
>feeling that you mean something completely different -- unfortunately it's not
>at all clear what from your message.

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

My problem is, that the I want to monitor netstat; this 
is in principle working (s.b.). But I don't want the scrolling
frame for 2 reasons.
  1.) ergonomic
  2.) after a while of outputting the display
       is stopping, I think for memory-reaons.

		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
import string
import time
#============================================ . . . . . . . . . . . . . . */
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.timer.Start(1000)

		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()

#       self.Clear()
#       Clear()
#       frame.Clear()
		print "--------------------------------------------------------------"
		yy=y.splitlines()
		for i in yy: 
			if i[:5]=="  TCP":
				ry=string.split(i)
				print "%5s %22s %22s %22s" % (ry[0],ry[1],ry[2],ry[3])
#============================================ . . . . . . . . . . . . . . */
class MyApp(wxApp):
	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