bend or redirect a class method and then call it again

Franz Steinhaeusler franz.steinhaeusler at utanet.at
Wed Jul 21 14:48:58 CEST 2004


Hello,

(in wxPython)

I want to redirect the SetStatusText
to an own method (change the text somewhat) and
then call the SetStatusText of wx.Frame.

But I have a little problem of understanding, but I think,
it should be achieved somehow.

the output of "show_status" should be then:
"mytext: hallo"

class MyFrame (wx.Frame):
	def show_status(self):
		SetStatusText ("hallo")

my_frame = Myframe

Plugin (my_frame)

def Plugin(frame_inst)

	#here i want to redirect the setstatustext
	
	setattr(frame_inst, 'SetStatusText', NewStatusText)
	
	def SetStatusText(te,text,nr=0):
			super(MyFrame, MyFrame).SetStatusText("mytext: " + te)
			#this is erronous

	def NewStatusText(s, n, n1= 0):
		SetStatusText(s, n, n1)
	
Is this possible?
How can I get this working?

thank you in advance
-- 
Franz Steinhaeusler



More information about the Python-list mailing list