Re: [pygtk] Attribute error: module object has no attribute 'Window'

2010-01-25 Thread Gian Mario Tagliaretti
On Mon, Jan 25, 2010 at 3:11 AM, Dick Thiebaud thiebauddi...@aol.com wrote:
 I get this on:

 import pygtk
 import gtk
 w = gtk.Window(WINDOW)

do you have created your example in a file called gtk.py?

p.s.
you don't need import pygtk

cheers
-- 
Gian Mario Tagliaretti
GNOME Foundation member
gia...@gnome.org
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


[pygtk] Sometimes VBox, sometimes HBox

2010-01-25 Thread David López Luengo
Hi everybody there,

Well, the question i'm going to ask could be done in h...@python.org too,
but since i got it from using pygtk i will first ask it here to use names
accordingly to pygtk and gtk in general. Other point, i'm not english so i
apologize for the (for sure) mistakes. Lets go.

I'm developing a class that needs sometimes to show what it contains in a
vertical paradigm an other times in an horizontal one. For this purpose i'm
using (or i want to use) gtk.VBoxes and gtk.HBoxes. When i initializes an
instance of this new own class i have a parameter just to discriminate what
kind of box i need. This own class inherits both from gtk.VBox and gtk.HBox
but, here comes the problem, when methods (inherited from Boxes) are called
the result is always from the first class inherited. For example:

...
HORIZONTAL = 1
VERTICAL = 2

class MyNewBox(gtk.HBox, gtk.VBox)

   def __init__(self, kind_of_box):
  if kind_of_box == HORIZONTAL:
 gtk.HBox.__init__(self)
  elif kind_of_box == VERTICAL:
 gtk.VBox.__init__(self)
  else:
 # probably raise an exception

...

With this scheme everything will work properly but always (even if i
initialize as VBox) i will get children in MyNewBoxes instances represented
horizontally since python defines multiple inheritance as depth-first, *
left-to-right* resolved.

Have you got an idea of how can i get horizontally or vertically
representation whenever it is necessary?

Thanks a lot :)


-- 
David
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] Sometimes VBox, sometimes HBox

2010-01-25 Thread Michael Urman
On Mon, Jan 25, 2010 at 06:50, David López Luengo ole...@gmail.com wrote:
 Have you got an idea of how can i get horizontally or vertically
 representation whenever it is necessary?

If you don't need to change the orientation at a later time, the
easiest way to do this would be to change your MyNewBox to a factory
method:

def MyNewBox(orientation):
if orientation == HORIZONTAL: return gtk.HBox()
if orientation == VERTICAL: return gtk.VBox()
raise ValueError(Unknown orientation)

-- 
Michael Urman
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] can't import gtk

2010-01-25 Thread Mathew Yeates
I get the error
AttributeError: 'module' object has no attribute 'CAPI'

The only place I see CAPI is in _cairo.so.

I've tried both pygtk-2.17.0 and pygtk-2.14.1.

Is there some magic combination of pycairo, pygtk etc?

Mathew
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can't import gtk

2010-01-25 Thread Bertrand Son Kintanar
On Mon, Jan 25, 2010 at 10:49 AM, Mathew Yeates mat.yea...@gmail.comwrote:

 I get the error
 AttributeError: 'module' object has no attribute 'CAPI'

 The only place I see CAPI is in _cairo.so.

 I've tried both pygtk-2.17.0 and pygtk-2.14.1.

 Is there some magic combination of pycairo, pygtk etc?

 Mathew


please avoid creating multiple posts on the same issue. can we see a
snippets of your code where this error spits out?



-- 
b3rx
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can't import gtk

2010-01-25 Thread Mathew Yeates
here's a snippet.
import gtk

Thats it! I immediately get the error.

On Mon, Jan 25, 2010 at 9:56 AM, Bertrand Son Kintanar 
b3rxkinta...@gmail.com wrote:

 On Mon, Jan 25, 2010 at 10:49 AM, Mathew Yeates mat.yea...@gmail.comwrote:

 I get the error
 AttributeError: 'module' object has no attribute 'CAPI'

 The only place I see CAPI is in _cairo.so.

 I've tried both pygtk-2.17.0 and pygtk-2.14.1.

 Is there some magic combination of pycairo, pygtk etc?

 Mathew


 please avoid creating multiple posts on the same issue. can we see a
 snippets of your code where this error spits out?



 --
 b3rx



___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can't import gtk

2010-01-25 Thread Yann Leboulanger
Mathew Yeates wrote:
 here's a snippet.
import gtk
 
 Thats it! I immediately get the error.

So your pygtk installation is not complete most probably. ry
re-installing it and its dependances

-- 
Yann
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] can't import gtk

2010-01-25 Thread John Stowers
On Mon, 2010-01-25 at 09:49 -0800, Mathew Yeates wrote:
 I get the error
 AttributeError: 'module' object has no attribute 'CAPI'
 
 The only place I see CAPI is in _cairo.so.
 
 I've tried both pygtk-2.17.0 and pygtk-2.14.1.
 
 Is there some magic combination of pycairo, pygtk etc?

Please continue this discussion on the following bug

https://bugzilla.gnome.org/show_bug.cgi?id=589671

 
 Mathew
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] can't import gtk

2010-01-25 Thread Mathew Yeates
Thanks John. I'm doing a Linux build. Is that bug discussion still relevant?

-Mathew

On Mon, Jan 25, 2010 at 11:43 AM, John Stowers john.stowers.li...@gmail.com
 wrote:

 On Mon, 2010-01-25 at 09:49 -0800, Mathew Yeates wrote:
  I get the error
  AttributeError: 'module' object has no attribute 'CAPI'
 
  The only place I see CAPI is in _cairo.so.
 
  I've tried both pygtk-2.17.0 and pygtk-2.14.1.
 
  Is there some magic combination of pycairo, pygtk etc?

 Please continue this discussion on the following bug

 https://bugzilla.gnome.org/show_bug.cgi?id=589671

 
  Mathew
  ___
  pygtk mailing list   pygtk@daa.com.au
  http://www.daa.com.au/mailman/listinfo/pygtk
  Read the PyGTK FAQ: http://faq.pygtk.org/



___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can't import gtk

2010-01-25 Thread John Stowers
On Mon, 2010-01-25 at 11:47 -0800, Mathew Yeates wrote:
 
 Thanks John. I'm doing a Linux build. Is that bug discussion still
 relevant?

Sorry, no. I saw the version numbers you mentioned and assumed that you
were talking about windows.

My mistake.

John
 


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/