Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.python > #3667

Problème d'importation de model

Newsgroups fr.comp.lang.python
Subject Problème d'importation de model
From Tornado09 <nospam_thierry.branchelot@sfr.fr.invalid>
Organization !No_Organization!
Message-ID <vLydnQmH5LMndjD8nZ2dnUU798zNnZ2d@giganews.com> (permalink)
Date 2021-12-06 04:53 -0600

Show all headers | View raw


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 ?

Back to fr.comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Probl�me d'importation de model Tornado09 <nospam_thierry.branchelot@sfr.fr.invalid> - 2021-12-06 04:53 -0600
  Re: Problème d'importation de model Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2021-12-06 13:29 +0100

csiph-web