Please help, python dont work

im new to panda and learning from tutorial, though my python does not work, when i run the program it stays grey, no code is misstyped, though some things arent the color of the code on tutorial, im using panda3d v1.7.0 what python should i use???

thx,

jared13

you should be running the python that comes with panda. Are you sure that you have everything correct? Maybe you didnt instance the app if you made it a class. What is the code that you have?

I assume you are a windows user. Panda3d comes with python and should be located in C:\Panda3D-1.7. I suggest adding it to your system path to make accessing python much simpler.

The default panda window should be gray, however I do not understand the rest of your question.

If this is your first time coding then I suggest spending some time learning python first before you attempt to tackle panda.

thx i know the question was confusing, i installed panda3d sdk, python dont look the same it is like cmd, do i code in it?

Ahh so it is your first time with python.
I suggest following this tutorial over the next several days to help you learn how to use python: greenteapress.com/thinkpytho … index.html

ok do i need to install python though

no, because panda comes with python

ok how do i acess python, i dont see it in start menu or c drive.
sorry for my lack of understanding

If it is in your system path (I don’t remember if it is by default for windows, I code in linux), you should be able to just type python in the command prompt. Otherwise python.exe will be in c:\panda3d

sorry does it look like windows cmd, if so how u code in it

Just follow the tutorial in the link I posted above.

I’m confused. I think jared13 is expecting to be able to type code in the Panda3D window.

yes, where do i code?

You can write your code in any text editor, or use an editor that is tailored to writing Python.
You should really learn at least the basics of Python first before attempting something like Panda3D otherwise you will find it extremely difficult.

ok i was following the tutorial and using notepad ++ some of the code in tutorial didnt work

in notepad ++, there’s no kind of python script launcher

i can recommend you only 2 IDE who’s work really great.
-pype IDE
-wingware python IDE

try both to know what’s the best IDE for you :slight_smile:

they are easy to install, and no additional plugin requierd

hope it was useful :slight_smile:

greetings

How do i make .egg files, as in the graphics and all?

There are a number of converters, one of the most popular one is called Chicken for the free modeling program Blender. However blender does take some time to learn as well.

I suggest spending the time getting comfortable with python first, then learning some basics of panda, then tackle modeling.

If you are interested in some more real time help, and willing to be polite :wink:, you can get some more real time help in our chatroom.

ok i use blender so no prob, but ive tried diff editors mentiond and they all have a prob when i add spin camera, plz check code.

from math import pi, sin, cos

from direct.showbase.ShowBase import ShowBase
from direct.task import Task

class MyApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

        # Load the environment model.
        self.environ = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.environ.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.setPos(-8, 42, 0)
		
		# Add the spinCameraTask procedure to the task manager.
		self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
		
	# Define a procedure to move the camera.
	def spinCameraTask(self, task):
		angleDegrees = task.time * 6.0
		angleRadians = angleDegrees * (pi / 180.0)
		self.camera.setPos(20 * sin(angleRadians), -10.0 * cos(angleRadians), 3)
		self.camera.setHpr(angleDegrees, 0, 0)
		return Task.cont
	
app = MyApp()
app.run()

Your tabs are wrong :slight_smile:

Python uses whitespace (tabs, enters, etc) to help manage the code. This is what it should look like.

from math import pi, sin, cos

from direct.showbase.ShowBase import ShowBase
from direct.task import Task

class MyApp(ShowBase):

    def __init__(self):
        ShowBase.__init__(self)

        # Load the environment model.
        self.environ = self.loader.loadModel("models/environment")
        # Reparent the model to render.
        self.environ.reparentTo(self.render)
        # Apply scale and position transforms on the model.
        self.environ.setScale(0.25, 0.25, 0.25)
        self.environ.setPos(-8, 42, 0)
      
        # Add the spinCameraTask procedure to the task manager.
        self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
      
   # Define a procedure to move the camera.
    def spinCameraTask(self, task):
        angleDegrees = task.time * 6.0
        angleRadians = angleDegrees * (pi / 180.0)
        self.camera.setPos(20 * sin(angleRadians), -10.0 * cos(angleRadians), 3)
        self.camera.setHpr(angleDegrees, 0, 0)
        return Task.cont
   
app = MyApp()
app.run() 

See how it lines up? Make sure that your editor is set to use four spaces for tabs, not three.