Am Montag, 2. März 2015 19:26:03 UTC+1 schrieb Adrian Klaver:
>
> On 03/02/2015 09:07 AM, Jaleks wrote: 
> > 
> > 
> > Am Montag, 2. März 2015 17:59:27 UTC+1 schrieb Adrian Klaver: 
> > 
> >     On 03/02/2015 08:19 AM, google....@wronghead.com <javascript:> 
> wrote: 
> >      > Hi all, 
> >      > 
> >      > somehow I do not get the auto-completion of Spyder (2.3.1 out of 
> >      > current Debian Sid) working for GTK usage. 
> >      > Following code was taken (and modified) from the PyGtk tutorial: 
> >      > 
> > 
> >      > 
> >      > which also made no difference (even after restarting Spyder) 
> >      > The code is in either case working as expected, so that should 
> >     not be 
> >      > the problem. 
> >      > 
> >      > If anyone has an idea how to fix this I'd be quite happy. 
> > 
> >     Do you have auto-completion working for anything? 
> > 
> > 
> > 
> > 
> > Auto-completion and showing of documentation works fine for other 
> > modules (os, sys, matplotlib), including self written ones. 
> > 
> >     Do you have Rope installed on your machine? 
> > 
> > 
> > Spyder's list of optional dependencies says "rope >=0.9.2 : 0.10.2 
> > (OK)", also all other optional dependencies (except of sympy) are 
> > installed and listed as OK. 
>
> Tried it here and saw the same thing. With some digging I think I know 
> the reason. PyGTK is just a wrapper around the GTK library, which I 
> believe is written in C. So when you are trying to find information on a 
> function it does not show anything because there are no doc strings in 
> the C function and the Python wrapper does not generate any either. It 
> is easier to see if you do the import in IPython and then do dialog.show? 
>

Indeed, if I do
from gi.repository import Gtk
dialog = Gtk.MessageDialog(None, 0,Gtk.MessageType.ERROR, Gtk.ButtonsType.
CLOSE, "unformated message")

in a fresh (Spyder's integrated) IPython, I get auto-completion for 
'dialog.' and also (sometimes) documentation when opening the first bracket 
of a function. Where that sometimes means, that I can not pinpoint it, when 
it works and when not. But what is reproducable is, that typing 
"Gtk.AboutDialogClass(" results in following Spyder error (in its internal 
console).

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/spyderlib/plugins/inspector.py", 
line 100, in validate
    valid = self.is_valid(qstr)
  File "/usr/lib/python2.7/dist-packages/spyderlib/plugins/inspector.py", 
line 82, in is_valid
    return shell.is_defined(objtxt, force_import=True)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/internalshell.py"
, line 453, in is_defined
    return self.interpreter.is_defined(objtxt, force_import)
  File "/usr/lib/python2.7/dist-packages/spyderlib/interpreter.py", line 314
, in is_defined
    namespace=self.locals)
  File "/usr/lib/python2.7/dist-packages/spyderlib/utils/dochelpers.py", 
line 292, in isdefined
    module = __import__(base, globals(), namespace)
  File "/usr/lib/python2.7/dist-packages/gi/overrides/Gtk.py", line 27, in 
<module>
    from ..overrides import override, strip_boolean_result, deprecated_init
ValueError: Attempted relative import in non-package
So, your answer sounds merely like a bug (or non-implemented feature) of 
Spyder, and not so much, that I am doing something wrong?

> 
>  > 
>  > (As I am quite new to Python, Spyder and also GTK, these trys might 
also 
>  > not be "the way" to import GTK libs, so if anybody could help out in 
any 
>  > direction I'd be happy.) 
>  > 
>  > Thanks, Jaleks 
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to spyderlib+unsubscr...@googlegroups.com.
To post to this group, send email to spyderlib@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.

Reply via email to