Add input method on textview in Gtk+ Python

I am using Gtk3+ with python 2.7

I have textview for which I want to add input methods for different language so that when a language keyboard gets use , then user can activate corresponding input method in application and can type in corresponding language.

What I want, when user right click on textview then the available input methods (available input methods for which I have DLLs so that when user will be clicking on any input method then corresponding DLL will get activate), and I wants to add these input method on the context menu which comes on right click on textview along with default options (Cut, copy, Paste etc.)

What I have tried is when my application adds spell check suggestion on 'populate-popup' signal then I tried to add another menuitem of 'Input Method' then added a submenu on that menu item with available language input method options.

Here it is :

in textview's init method :

self.connect('populate-popup', self._add_spell_suggestions)

def _add_spell_suggestions(self, text_view, menu, user_data=None):
        IM = gtk.MenuItem('Input Methods')
        IM.connect('motion-notify-event', self.focusMethod)
        #IM.connect('activate', self.inputMethod)

def focusMethod(self, IM, non):
        langs = {'None':None, 'lang1':'lang1.dll', 'lang2':'lang2.dll'}
        lang = gtk.Menu()
        option = None
        for key in langs :
            print key
            option = gtk.RadioMenuItem(key, group = option)
            option.connect('toggled', self.input_lang, key)
            option.set_active(key == 'None')
        lang.popup(None, None, None, None, 3, 0)

 def input_lang(self, a, lang_inp):
        """Method to make immodules.cache file and write query in 
           immodules.cache to activate selected inputmethod's DLL
        import os
        print os.getcwd()
        #file_dir = os.getcwd()+ '\lib\gtk-3.0'
        file_dir = 'C:\Program Files (x86)\application\lib\gtk-3.0'
        cache_filename = file_dir + '\\3.0.0\immodules.cache'
        dll_path = file_dir + '\\immodules\\' + lang_inp + '.dll'
        if os.path.exists(unicode(cache_filename)):
        with open(unicode(cache_filename), 'w') as e: e.write('1')

I tried to add menuitem with uimanager also :

ui_xml = '''
        <popup name="MethodOfInput">
            <menuitem action="NotSelected"/>
            <menuitem action="Lang1"/>
            <menuitem action="Lang2"/>

        self.uimanager = gtk.UIManager()
        self.input_actiongroup = gtk.ActionGroup('InputMethodActions')
        self.uimanager.insert_action_group(self.input_actiongroup, 0)
        self.itemen = self.uimanager.get_widget('/MethodOfInput')

It was not successful.

In first method also some random behavior is coming like when I right click on textview, it comes like :

input method cotext menu

It is overlapping menuitem, where as that submenu should come on the right side of menuitem(Input Method), also after selecting a option menu context menu doesn't disappear.

Is there any other way of doing it like by using Gtk.IMContext? OR in this way also it is not successful.

I want add it as option in right click menu of textview.