#!/usr/bin/env python import sys from omniORB import CORBA, PortableServer # Import the stubs and skeletons for the Example module import Example, Example__POA # Initialize the ORB orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Find the root POA poa = orb.resolve_initial_references("RootPOA") # create dummy sb class SB(object): pass sb=SB() # Define an implementation of the Echo interface class Echo_i (Example__POA.Echo): def echoString(self, mesg): wx.CallAfter(sb.text.AppendText,mesg+'\n') return mesg # Create an instance of Echo_i ei = Echo_i() # Create an object reference, and implicitly activate the object eo_srv = ei._this() # Write IOR2 to a file fd = open('IOR2.txt', mode = 'w+') fd.write(orb.object_to_string(eo_srv)) fd.close() # Activate the POA poaManager = poa._get_the_POAManager() poaManager.activate() # Get the IOR of an Echo object from a file (without # checking that the arguments are sensible!) # loop until file containing IOR1 exists import os while not os.access('IOR1.txt',os.F_OK): pass # get IOR1 from file fd = open('IOR1.txt', mode = 'r') ior = fd.read() fd.close() # delete IOR1 file os.remove('IOR1.txt') # Convert the IOR to an object reference obj = orb.string_to_object(ior) # Narrow reference to an Example::Echo object eo_clt = obj._narrow(Example.Echo) if eo_clt is None: print "Object reference is not an Example::Echo" sys.exit(1) import wx app=None class SimpleButton(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) pnl = wx.Panel(self, -1) wx.Button(pnl, 1, 'Send', (150, 130)) self.text = wx.TextCtrl(pnl, -1,'',(250, 130),size=(200, 130), style=wx.TE_MULTILINE) wx.EVT_BUTTON(self, 1, self.OnSend) self.Show(True) def OnSend(self, event): message = "Hello from Python" result = eo_clt.echoString(message) app = wx.App() sb = SimpleButton(None, -1, 'simple button example') app.MainLoop()