Deutsch   English   Français   Italiano  
<vLydnQmH5LMndjD8nZ2dnUU798zNnZ2d@giganews.com>

View for Bookmarking (what is this?)
Look up another Usenet article

X-Received: by 2002:a05:600c:1d97:: with SMTP id p23mr37955002wms.144.1638788091981;
        Mon, 06 Dec 2021 02:54:51 -0800 (PST)
MIME-Version: 1.0
Path: ...!buffer2.nntp.ams1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 06 Dec 2021 04:53:45 -0600
Newsgroups: fr.comp.lang.python
Subject: Problème d'importation de model
X-poster: PEAR::Net_NNTP v1.5.0 (stable)
From: Tornado09 <nospam_thierry.branchelot@sfr.fr.invalid>
Organization: !No_Organization!
Message-ID: <vLydnQmH5LMndjD8nZ2dnUU798zNnZ2d@giganews.com>
Date: Mon, 06 Dec 2021 04:53:46 -0600
Lines: 49
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-eHWK1IpjjlDTYMCOLWUBFvr6U8Hj69fPPjO24lOfXRpgU8nWTN/LISzhuGN52GPaoErMgUsWi4vlG4u!kwULiYu0g/aoNG3RdUALu/xvNAQBzwznjAN4Ib1eYfaBC5mv79sD/a1BBiBheTGu5AB8Abkhdn3R
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Lines: 43
X-Original-Bytes: 2495
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
Bytes: 2873

Bonjour,

     J'apprend actuellement le Python par le biais du développement d'un petit
jeu 3D. Mon premier objectif est l'importation d'un model dans une fenêtre. Le
code est simple, mais je n'arrive pas l'exécuter dans mon environnement.
J'utilise PyCharm 2021.3 et panda3d 1.10.10.
      
     Quand j'exécute le scripte ci-dessous qui fonctionne très bien dans les
tutos que je regarde :


from panda3d.core import loadPrcFile
loadPrcFile("config/conf.prc")

from direct.showbase.ShowBase import ShowBase

class MyGame(ShowBase):

    def __init__(self):
        super().__init__()

        pion = self.loader.loadModel("Models/Pion.egg")
        pion.setPos(0, 10, 0)
        pion.reparenTo(self.render)

game = MyGame()
game.run()


Il me génère l'erreur suivante sans m'affiche mon model :


C:UsersUtilisateurPycharmProjectspythonProject2venvScriptspython.exe
C:/Users/Utilisateur/PycharmProjects/pythonProject2/main.py
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
Traceback (most recent call last):
  File "C:/Users/Utilisateur/PycharmProjects/pythonProject2/main.py", line 15,
in <module>
    game = MyGame()
  File "C:/Users/Utilisateur/PycharmProjects/pythonProject2/main.py", line 13,
in __init__
    pion.reparenTo(self.render)
AttributeError: 'panda3d.core.NodePath' object has no attribute 'reparenTo'

Process finished with exit code 1


     Pouvez-vous me dire d'où vient le problème ?