I found what is the problem ! Actually, i found why my old venv is working 
and why cocos2d official code is not ! I totally forgot this pull request: 
https://github.com/los-cocos/cocos/pull/296 , my old venv is based on this 
code XD
In my example code, tileset have a different tile width/height than the tmx 
map, and cocostiles#load_tmx don't be careful with that.

I don't know if you are able to accept pull requests of 
https://github.com/los-cocos/cocos pull request but maybe you can look at 
it ^^

Le jeudi 7 décembre 2017 21:06:05 UTC+1, Bastien Sevajol a écrit :
>
> Additional notes: Add a sprite is totally working, with this code:
>
> from cocos.director import director
> from cocos.tiles import load
> from cocos.layer import ScrollingManager
> from cocos.layer import pyglet
> from cocos.scene import Scene
> from cocos.sprite import Sprite
>
> director.init()
> a = load("demo.tmx")["mytiles"]
> img = Sprite('eyes.png')
> scroller = ScrollingManager()
> scroller.add(a)
> scene = Scene()
> scene.add(scroller)
> scene.add(img)
> director.run(scene)
>
> The eye.png sprite is visible in both venvs.
>
> Le jeudi 7 décembre 2017 09:18:35 UTC+1, Bastien Sevajol a écrit :
>>
>> Hello,
>>
>> (Note: i'm testing on second computer, Debian 8, 3.16.0-4-amd64, python 
>> 3.5 too: same black screen)
>> I followed your steps. After venv created, pyglet and cocos cloned, and 
>> .pth file created. pyglet tag availables:
>>
>> tip                             3930:d401d45e0d0d
>>> pyglet-1.4.0a1                  3910:e7ab9d8d8ea3
>>> pyglet-1.3.0                    3781:64acbbeafb8f
>>> pyglet-1.3.0rc2                 3772:5d692ab5986e
>>> pyglet-1.3.0rc1                 3748:14afb5a0054d
>>> pyglet-1.2.4                    3292:10f07039613b
>>> pyglet-1.2.3                    3222:92cd120b6cb9
>>> pyglet-1.2.2                    3073:12bb2e852335
>>> pyglet-1.2.0                    2990:b5a21da8dbba
>>> pyglet-1.2.0rc3                 2978:b36873813f83
>>> release-1.2rc1                  2949:5194a6b8be4f
>>> release-1.2alpha1               2721:5df7a60a32bb
>>> last_pyobjc_version             2670:7ed1b86b049f
>>> pyglet-1.1.4                    2264:dff26a5c440e
>>> pyglet-1.1.4-rc1                2258:bd0bf56e2101
>>> pyglet-1.1.3                    2182:0e88949deaba
>>> pyglet-1.1.2                    2160:59cb56b04ee4
>>> pyglet-1.1.1                    2118:97ed8929975e
>>> pyglet-1.1                      2084:2db88439ccb3
>>> pyglet-1.1beta2                 2036:cb3e6f1ed68c
>>> pyglet-1.1beta1                 1959:ce8a50069a13
>>> pyglet-1.1alpha2                1909:21fb7f6ce977
>>> pyglet-1.1alpha1                1795:e22423cd9c4a
>>> pyglet-1.0                      1544:b5ed21968f06
>>> pyglet-1.0beta3                 1452:b30bbb44efa6
>>> pyglet-1.0beta2                 1364:c7eac959dc0c
>>> pyglet-1.0beta1                 1337:084e5d57609d
>>> pyglet-1.0alpha2                1143:f2b5c7e11d7f
>>> pyglet-1.0alpha1                 937:727c422fcc95
>>
>>
>> With pyglet on tag pyglet-1.3.0rc2 and cocos on tag release-0.6.5: black 
>> screen. Same black screen with pyglet-1.3.0rc1, pyglet-1.3.0 
>> and pyglet-1.4.0a1. Tested with cocos on release-0.6.4, same black screen.
>>
>> I will test again on thirst computer tonight (ubuntu) but i guess the 
>> result will be the same. Note, tested with python 2.7: same black screen.
>>
>> I can make more deep tests if needed !
>>
>> Le jeudi 7 décembre 2017 03:40:13 UTC+1, Claudio Canepa a écrit :
>>>
>>> >Still black screen (note pyglet 1.3.0b1 was keep: "Requirement already 
>>> satisfied: pyglet>=1.2 in ./venv3.5/lib/python3.5/site-packages (from 
>>> cocos2d)").
>>>
>>> Lets do in a manual fashion so we get the exact version.
>>>
>>> - create a dir to hold all needed, say /home/bux/testcocos
>>>       
>>> - move to that dir,
>>>       cd /home/bux/testcocos
>>>
>>> - create a fresh virtualenv with the line
>>>        python3 -m venv myenv
>>>   It will have no package installed, it should have created the dir /
>>> home/bux/testcocos/myenv
>>>
>>> - activate it
>>>       source myenv/bin/activate
>>>
>>> - Now we should be in the venv console; In ubuntu 17.10 'python' in the 
>>> venv console refers to the python in the venv, which is py3.5 for you.
>>>
>>> - Add six with
>>>      python -m pip install six
>>>
>>> - Add future
>>>     python -m pip install future
>>>   
>>> - clone pyglet
>>>       hg clone https://bitbucket.org/pyglet/pyglet
>>> This should have created the directory /home/bux/testcocos/pyglet with 
>>> the clone; it will be at the last version in the default branch.
>>> Later the version will be adjusted.
>>>
>>> - clone cocos
>>>      git clone https://github.com/los-cocos/cocos.git
>>>   will clone the repo to the dir cocos, it should have created the dir /
>>> home/bux/testcocos/cocos
>>>
>>> - Say the python in the venv where to find cocos and pyglet
>>>       - create a file /home/bux/testcocos/myenv//lib/python3.5/site-
>>> packages/py35_cocos_pyglet.pth
>>>       - edit the file adding the lines (with zero indentation)
>>>              /home/bux/testcocos/pyglet
>>>              /home/bux/testcocos/cocos
>>>      - save the file
>>>
>>> Now the python in the venv should see both pyglet and cocos
>>>
>>> - Adjust the pyglet version
>>>   First move to the pyglet dir
>>>       cd /home/bux/testcocos/pyglet
>>> pyglet versions are tagged in the repository, and to see the tags
>>>      hg tags
>>> (will list all the tags, by example pyglet-1.4.0a1 ,  pyglet-1.3.0 , 
>>> pyglet-1.3.0rc2, pyglet-1.3.0rc1 ...)
>>> To change to a specific version we need to do an  hg update <tag>. 
>>> Note you should not move to tags 1.2.x or below, those pyglet versions 
>>> can't run directly on py3
>>>
>>> - Lets set the "good" version; I understand from your first post it is 
>>> 1.3.0b1
>>>   Umm. No tag with the exact string. Lets try tag pyglet-1.3.0rc2
>>>        hg update pyglet-1.3.0rc2
>>>
>>> - Adjust the cocos version. For pyglet 1.3.xxxxxx you will need at least 
>>> 0.6.5
>>>      cd /home/bux/testcocos/cocos
>>>  list the tags with
>>>    git tags -l
>>>  Lets try 0.6.5 ; it has the tag release-0.6.5
>>>    git checkout release-0.6.5
>>>
>>> - Okay, now run your test from the venv
>>>      python ....
>>>
>>> - if it runs bad, go to a prior pyglet tag and test again (don't go to 
>>> tags 1.2.x)
>>> - if it runs ok, advance to the next tag in pyglet and test again
>>> - also test with the newer pyglet tag, currently pyglet-1.4.0a1
>>>
>>> This should tell which pyglet version, if any, has problems.
>>>
>>>
>>>    
>>>
>>>
>>>
>>> On Wed, Dec 6, 2017 at 7:10 PM, Bastien Sevajol <[email protected]> 
>>> wrote:
>>>
>>>> Hello, following this steps:
>>>>
>>>> ➜  cocos2d_tiledmap_demo git:(master) virtualenv --no-site-packages -p 
>>>> /usr/bin/python3.5 venv3.5
>>>> Running virtualenv with interpreter /usr/bin/python3.5
>>>> Using base prefix '/usr'
>>>> New python executable in /tmp/cocos2d_tiledmap_demo/venv3.5/bin/python3
>>>> .5
>>>> Also creating executable in /tmp/cocos2d_tiledmap_demo/venv3.5/bin/
>>>> python
>>>> Installing setuptools, pkg_resources, pip, wheel...done.
>>>> ➜  cocos2d_tiledmap_demo git:(master) source venv3.5/bin/activate
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip install pyglet==1.3
>>>> .0b1
>>>> Collecting pyglet==1.3.0b1
>>>>   Using cached pyglet-1.3.0b1-py2.py3-none-any.whl
>>>> Collecting future (from pyglet==1.3.0b1)
>>>> Installing collected packages: future, pyglet
>>>> Successfully installed future-0.16.0 pyglet-1.3.0b1
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip install six==1.10.0
>>>> Collecting six==1.10.0
>>>>   Using cached six-1.10.0-py2.py3-none-any.whl
>>>> Installing collected packages: six
>>>> Successfully installed six-1.10.0
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip install cocos2d
>>>> Collecting cocos2d
>>>> Requirement already satisfied: six>=1.4 in ./venv3.5/lib/python3.5/site
>>>> -packages (from cocos2d)
>>>> Requirement already satisfied: pyglet>=1.2 in ./venv3.5/lib/python3.5/
>>>> site-packages (from cocos2d)
>>>> Requirement already satisfied: future in 
>>>> ./venv3.5/lib/python3.5/site-packages 
>>>> (from pyglet>=1.2->cocos2d)
>>>> Installing collected packages: cocos2d
>>>> Successfully installed cocos2d-0.6.5
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip freeze
>>>> cocos2d==0.6.5
>>>> future==0.16.0
>>>> pkg-resources==0.0.0
>>>> pyglet==1.3.0b1
>>>> six==1.10.0
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) python -c "import 
>>>> pyglet; print(pyglet.version)"
>>>> 1.3.0b1
>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) python demo.py
>>>>
>>>> Still black screen (note pyglet 1.3.0b1 was keep: "Requirement already 
>>>> satisfied: pyglet>=1.2 in ./venv3.5/lib/python3.5/site-packages (from 
>>>> cocos2d)").
>>>>
>>>> Le mercredi 6 décembre 2017 22:48:50 UTC+1, Claudio Canepa a écrit :
>>>>>
>>>>> Sorry, I missed you included the pyglet versions. 1.3.0b1 and 1.3.0
>>>>>
>>>>>
>>>>> Could you try this:
>>>>>
>>>>>  - create new venv
>>>>>  - pip install the dependencies first, asking for the specific 
>>>>> versions in the 'known good' install
>>>>>  - pip install cocos 
>>>>>  - verify installed versions are as expected
>>>>>  - try the program to see if behaves well.
>>>>>
>>>>> if it does well, pip unistall pyglet and do a pip install pyglet 
>>>>> without version; that should give last pyglet.
>>>>> Try the program to see if runs well or not.
>>>>>
>>>>>   
>>>>>
>>>>>
>>>>> On Wed, Dec 6, 2017 at 6:39 PM, claudio canepa <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Hi Bastien.
>>>>>>
>>>>>> Could you verify which pyglet you have in each venv?
>>>>>> In theory you could start the python in the virtualenv and then do
>>>>>>   import pyglet
>>>>>>   print(pyglet.version)
>>>>>>
>>>>>> That should give some approximate version.
>>>>>> I'm not sure sure if pyglet really updated the declared version for 
>>>>>> each alpha, if no difference in the declared version we can investigate 
>>>>>> later.
>>>>>>
>>>>>> Also posibilities;
>>>>>>   - pyglet has an optional dependency on Pillow; it is present in one 
>>>>>> of the venvs ?
>>>>>>   - last pyglet versions did some magic to import the module 'future' 
>>>>>> (not the built in future; a package available on pip; could it be 
>>>>>> different 
>>>>>> 'future' versions ?
>>>>>>
>>>>>>  
>>>>>>
>>>>>> On Wed, Dec 6, 2017 at 6:00 PM, Bastien Sevajol <[email protected]
>>>>>> > wrote:
>>>>>>
>>>>>>> I forgot to add attached files. There are in this mail.
>>>>>>>
>>>>>>>
>>>>>>> Le mercredi 6 décembre 2017 21:58:30 UTC+1, Bastien Sevajol a écrit :
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I have a stange problem with TiledMap. Following this steps:
>>>>>>>>
>>>>>>>>    1. Linux, Ubuntu: 4.10.0-40-generic with python3.5 installed
>>>>>>>>    2. Clone example script: git clone 
>>>>>>>>    https://github.com/buxx/cocos2d_tiledmap_demo.git
>>>>>>>>    3. Go into it: cd cocos2d_tiledmap_demo
>>>>>>>>    4. Create a virtual env: virtualenv --no-site-packages -p 
>>>>>>>>    /usr/bin/python3.5 venv3.5
>>>>>>>>    5. Source it: source venv3.5/bin/activate
>>>>>>>>    6. Install cocos2d: pip install cocos2d
>>>>>>>>    7. Start script: python demo.py
>>>>>>>>
>>>>>>>> I got a black screen (see with_fresh_install.png in attached 
>>>>>>>> files). But if i source an old virtual env (same python version) of 
>>>>>>>> previous cocos2d test, map is correctly loaded (see 
>>>>>>>> with_old_venv.png). I 
>>>>>>>> can found little versions differences between fresh and old venv:
>>>>>>>>
>>>>>>>>
>>>>>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) source /home/bux/
>>>>>>>> Projets/cocos/venv3.5/bin/activate
>>>>>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip freeze
>>>>>>>> cocos2d==0.6.4
>>>>>>>> future==0.16.0
>>>>>>>> pkg-resources==0.0.0
>>>>>>>> pyglet==1.3.0b1
>>>>>>>> six==1.10.0
>>>>>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) source venv3.5/bin/
>>>>>>>> activate
>>>>>>>> (venv3.5) ➜  cocos2d_tiledmap_demo git:(master) pip freeze
>>>>>>>> cocos2d==0.6.5
>>>>>>>> future==0.16.0
>>>>>>>> pkg-resources==0.0.0
>>>>>>>> pyglet==1.3.0
>>>>>>>> six==1.11.0
>>>>>>>>
>>>>>>>> But if i pip install same versions, same black screen. So i d'ont 
>>>>>>>> think version differences is responsible. What can be the reason of 
>>>>>>>> error ? 
>>>>>>>> Where can i debug cocos (pyglet ?) source code to maybe found info 
>>>>>>>> about 
>>>>>>>> that ?
>>>>>>>>
>>>>>>>> Thank's.
>>>>>>>>
>>>>>>> -- 
>>>>>>> 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.
>>>>>>>
>>>>>>
>>>>>>
>>>>> -- 
>>>> 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.
>>>>
>>>
>>>

-- 
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