I am using the same code and am getting this error: Traceback (most recent 
call last):
  File "C:/Users/Jeanne and 
Phil/AppData/Local/Programs/Python/Python35-32/helloworld.py", line 3, in 
<module>
    class HelloWorld(cocos.layer.Layer):
  File "C:/Users/Jeanne and 
Phil/AppData/Local/Programs/Python/Python35-32/helloworld.py", line 11, in 
HelloWorld
    anchor_x='center', anchor_y='center')
  File "C:\Users\Jeanne and 
Phil\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cocos\text.py",
 
line 65, in __init__
    super(TextElement, self).__init__()
  File "C:\Users\Jeanne and 
Phil\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cocos\cocosnode.py",
 
line 136, in __init__
    self.camera = Camera()
  File "C:\Users\Jeanne and 
Phil\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cocos\camera.py",
 
line 61, in __init__
    self.restore()
  File "C:\Users\Jeanne and 
Phil\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cocos\camera.py",
 
line 81, in restore
    width, height = director.get_window_size()
  File "C:\Users\Jeanne and 
Phil\AppData\Local\Programs\Python\Python35-32\lib\site-packages\cocos\director.py",
 
line 554, in get_window_size
    return self._window_virtual_width, self._window_virtual_height
AttributeError: 'Director' object has no attribute '_window_virtual_width'
>>> 

On Thursday, February 4, 2016 at 8:21:15 PM UTC-5, Michael Calvey wrote:
>
> Hello all,
>
> I am brand new to cocos, and I am trying to find the best engine/ library 
> for a top down game I am about to start working on. While going through the 
> hello world exercise in the docs, I am receiving an AttributeError.
>
> Here is the code:
> import cocos
>
> class HelloWorld(cocos.layer.Layer):
>
>     def __init__(self):
>         super( HelloWorld, self).__init__()
>
>     label = cocos.text.Label('Hello, world',
>                               font_name='Times New Roman',
>                               font_size=32,
>                               anchor_x='center', anchor_y='center')
>     label.position = 320,240
>     self.add( label )
>     cocos.director.director.init()
>     hello_layer = HelloWorld ()
>     main_scene = cocos.scene.Scene (hello_layer)
>     cocos.director.director.run (main_scene)
>
> And the traceback:
> Traceback (most recent call last):
>   File "/Users/michaelcalvey/Documents/cocos.py", line 1, in <module>
>     import cocos
>   File "/Users/michaelcalvey/Documents/cocos.py", line 4, in <module>
>     class HelloWorld(cocos.layer.Layer):
> AttributeError: module 'cocos' has no attribute 'layer'
>

Any suggestions? My file name is helloworld.py 

>
> Thanks a lot for the help, sorry if it is an obvious problem but I have 
> looked around and haven't found anything relevant.
> I am really looking forward to getting this to work!
>
> Michael
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to