Menu ▾ ▴

code completion with gtk library

Greg A
2009-05-02
2013-03-15
  • Greg A

    Greg A - 2009-05-02

    I just started using Pydev and I really like it.  However, I'm having trouble getting code completion to work for anything other than the built-in libraries.  For example, I have not been able to get code completion to work for the gtk library.  Entering

    import gtk
    gtk.

    does not show any completions.  I have followed the steps recommended on

    http://faq.pygtk.org/index.py?file=faq23.043.htp&req=show

    and I've tried all the suggestions in the other threads on this subject in this forum, but still no luck.  The code runs fine so the libraries are installed correctly.

    I'd really appreciate the complete steps to get code completion working for this library or pointers about how to go about debugging it.  For example, exactly which gtk libraries need to be installed, which additional paths should be configured for the Python interpreter under System PYTHONPATH, which additional libraries should be added to the Forced Builtins, etc.

    I have also looked in ~/eclipse/.metadata/.log and there are no messages related to this.

    I'm using Eclipse 3.4.2 with Pydev 1.4.5.2727 and Python 2.6.2 on Ubuntu 9.04.

    Thanks.

     
    • Greg A

      Greg A - 2009-05-02

      I just noticed the option Pydev | Logging | Enable logging for code completion?  After enabling this, I get

      PyCodeCompletion: Starting getCodeCompletionProposals
          PyCodeCompletion: Request:CompletionRequest[ editorFile:/home/greg/eclipse/Test/src/Test.py activationToken:gtk. qualifier: isInCalltip:false alreadyHasParams:false]
          PyCodeCompletion: AbstractShell.getServerShell
          AbstractShell: Synchronizing on shells...
          AbstractShell: Getting shell related to:Python id:1
          PyCodeCompletion: END AbstractShell.getServerShell
          ASTManager: internalGenerateGetCompletionsForModule: Test -- gtk
          ASTManager: internalGenerateGetCompletionsForModule: gtk --
          ASTManager: getGlobalCompletions: gtk --
          ASTManager: internalGenerateGetCompletionsForModule: __builtin__ -- gtk
      PyCodeCompletion: Finished completion. Returned:0 completions.

      I still don't know what's wrong, but I thought this might be helpful.

       
    • Charles H

      Charles H - 2009-05-02

      I have the same problem. 

      Code completion was working with Python 2.5.2, Eclipse 3.4.2, PyDev 1.4.5.2727, and Ubuntu 8.04.

      After upgrading to Ubuntu 9.04, I'm now using Python 2.6.2, Eclipse 3.4.2, PyDev 1.4.5.2727.  Now code completion is not working.

      Charles

       
    • Charles H

      Charles H - 2009-05-02

      code completion also no longer working on Mac OS X 10.4.11 using Python 2.6.2, Eclipse 3.4.2, PyDev 1.4.5.2727

      Charles

       
    • Charles H

      Charles H - 2009-05-02

      Problem solved:

      In the main menu, go to Eclipse|Preferences on the Mac, on Linux go to Window|Preferences.

      In preferences window, go to "Pydev|Interpreter - Python", then remove and re-add the interpreter.

      Charles

       
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-05-02

      What's the system pythonpath you're using? (if you added gtk after configuring the interpreter, there's a good chance that you need to update your system pythonpath... the simpler way of doing that is just removing the interpreter and adding it again).

      Cheers,

      Fabio

       
    • Greg A

      Greg A - 2009-05-03

      I did install gtk after I configured the python interpreter in Pydev.  I removed the interpreter and added it again and now code completion works for gtk!  However, method parameters are not shown for the gtk classes.  For example,

      import gtk

      w = gtk.Window()

      w.set_title(

      does not show the 'title' parameter.

      Thank you Charles and Fabio so much for your help.

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2009-05-03

        Actually, regarding the parameters, currently, there's no way for pydev to gather that info (all the gtk tokens come from a compiled module, and python is unable to provide information about the parameters for those modules, even at runtime).

        Cheers,

        Fabio