I am totally new to Python and WxPython and need to write an application which can open up an external windows from a plug-in within GAIM (using pyGAIM). I have managed to hack some code together from what little I have covered so far, however GAIM refuses to open until I have closed the extra window. I appreciate this is probably a simple point but I would be grateful for any advice people can offer on how I can make them both appear so that people can interact with either GAIM and/or the contents of the window. I am using Python 2.3.5, and GAIM 2 (beta).
I have attached the hacked code below which is based on a merging some samples from WxPython and pyGaim. I have tried moving the bit below to within def plug_in load but to no avail. "app = MyApp(0) app.MainLoop()" Thanks in advance, Rod ---- import _gaim import wx from wxPython.wx import * ID_ABOUT = 101 ID_EXIT = 102 class MyFrame(wxFrame): def __init__(self, parent, ID, title): wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, wxSize(200, 150)) self.CreateStatusBar() self.SetStatusText("This is the statusbar") menu = wxMenu() menu.Append(ID_ABOUT, "&About", "More information about this program") menu.AppendSeparator() menu.Append(ID_EXIT, "E&xit", "Terminate the program") menuBar = wxMenuBar() menuBar.Append(menu, "&File"); self.SetMenuBar(menuBar) EVT_MENU(self, ID_ABOUT, self.OnAbout) EVT_MENU(self, ID_EXIT, self.TimeToQuit) def OnAbout(self, event): dlg = wxMessageDialog(self, "This sample program shows off\n" "frames, menus, statusbars, and this\n" "message dialog.", "About Me", wxOK | wxICON_INFORMATION) dlg.ShowModal() dlg.Destroy() def TimeToQuit(self, event): self.Close(true) class MyApp(wxApp): def OnInit(self): frame = MyFrame(NULL, -1, "Hello from wxPython") frame.Show(true) self.SetTopWindow(frame) return true PLUGIN_INFO = { 'python_api_version' : 2, 'name' : "A Simple Test Plug-in", 'version' : "0.3", 'summary' : "This simply does nothing", 'description' : "Cheese", 'author' : "[EMAIL PROTECTED]", 'url' : "http://www.xxx.com/", 'load' : "plugin_load", 'unload' : "plugin_unload" } def timeout0(anObject): print 'py:timeout0',anObject return False def timeout1(anObject): print 'py:timeout1',anObject ## return True return False def signed_on_cb1(data,account,conv,msgText): print 'p2:signed_on_cb1' print 'Data',data print 'account',account print 'conversation',conv print 'msgText',msgText print 'account.gc',account.gc blist = gaim.gaim_get_blist() print blist.root print conv.name,conv.title,conv.history buddy = gaim.gaim_find_buddy(account,conv.name) print buddy,buddy.name,buddy.alias group = gaim.gaim_find_buddys_group(buddy) print group,group.name,group.totalsize return {'r':True,'a3':'this is my text:'+msgText} def menu_item_activate_cb(node,data): pass def blist_node_extended_menu_cb(data,node,menu): print 'node',node print 'menu',menu ## if (!GAIM_BLIST_NODE_IS_BUDDY(node)) ## return; ## buddy = (GaimBuddy *)node; ## act = gaim.gaim_blist_node_action_new("Send message", ## menu_item_activate_cb,None) ## print act ## *menu = g_list_append(*menu,act); def plugin_load(plugin): print 'py:plugin_load' accs = gaim.gaim_accounts_get_all() print accs for account in accs: print account if account: print account.username,account.alias print 'New:',gaim._GaimAccount() gaim.gaim_python_timeout_add(plugin,2000,timeout0,"this is timeout 0") gaim.gaim_python_timeout_add(plugin,1000,timeout1,"this is timeout 1") handle = gaim.gaim_conversations_get_handle() gaim.gaim_python_signal_connect(plugin,handle,"writing-im-msg", signed_on_cb1,"abc") gaim.gaim_python_signal_connect(plugin,gaim.gaim_blist_get_handle(), "blist-node-extended-menu", blist_node_extended_menu_cb,None); print 'py:after plugin load' def plugin_unload(plugin): print 'py:plugin_unload' app = MyApp(0) app.MainLoop() -- http://mail.python.org/mailman/listinfo/python-list