[Solved]Changing the Window Title

The default Window Title is “Panda”… is it possible to change to something else?

eg. “My First Panda” ?

Here you go:

# get "WindowProperties" instance
WinProps = base.win.getProperties() 

WinProps.setTitle("My First Panda")

You can use this to set other window related properties as well.

See “WindowProperties” in the reference section of the manual.

Basically it worked, but there would be a lag (the old title still showed) while my scene and models were still loading; it would be set to the new title when completed.

Any ways to improve it?

If you want to change it like it’s the default, you should change it before importing the DirectStart.

from pandac.PandaModules import * 
loadPrcFileData("", "win-title My First Panda") 
import direct.directbase.DirectStart

Read for more :
You can get the list of the config variables :


Thanks so much. It works perfectly now! :laughing:

Also note you can edit the config file manually for config variables, something people sometimes tend to forget. Open your config.prc with a text editor and find the line starting with “window-title” and change the value to the title of your choice. If the line doesn’t exist, you can add it yourself.

I find it better practice to make static changes like this in the config file since you wont be loading up the default value first and then re-loading the new value in code. More importantly, if someone else has to look at your code, and wants to change a config variable, they won’t be confused when the variable doesn’t change because you overwrote it in separate code. After all, the config file was meant to store the configuration values.

It doesn’t work at all for me. Any ideas why? I know the code is being executed because the fullscreen part works fine. I still get the “Panda” title bar.

# Standard imports

import sys
import math

# Panda imports

from pandac.PandaModules import *
loadPrcFileData("", "win-title TITLE GOES HERE")
loadPrcFileData("", "fullscreen 0")
import direct.directbase.DirectStart

from direct.task import Task
from direct.showbase.DirectObject import *

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Define the scene

class Scene(DirectObject):
	def __init__(self):
		self.mTimeStep = 1
		self.mTimeAccum = 0
		taskMgr.add(self.timeUpdate, 'TimeUpdate')

	def timeUpdate(self,task):
		self.mTimeAccum += globalClock.getDt()
		if self.mTimeAccum > self.mTimeStep :
			print task.time
			self.mTimeAccum = 0
		return Task.cont

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Create the scene

scene = Scene()

# Run the viz


I figured it out … the tag “win-title” you write of above is incorrect. It is actually “window-title”.

loadPrcFileData("", "win-title TITLE GOES HERE") 


loadPrcFileData("", "window-title TITLE GOES HERE") 

Oh, my bad. Of course it’s ‘window-title’. Sorry, I didn’t actually look at my config vars list. BTW, why are there two prefix ‘win-’ and ‘window-’ anyway ? It could drive us into confusion like this.

IMO, Editing the config.prc is only for the very very general config. For this case, editing the config.prc is not a good idea, because each project has specific & different config that need to be changed, without doing the change (or copying) everytime one installing new version.

Yep, it sure can. Sorry about that; this is one of those things that happens when a project (like Panda3D) is developed over a long period of time by several different people. It also becomes difficult to reconcile these things as more and more projects start to code to the way it is now.

Actually, the intended design is that each application should have its own, particular prc file (in addition to the very general config.prc file). Panda is designed to find and load multiple different prc files, in a deterministic, hierarchical order; the idea is that you would have (for instance) an airblade.prc file which contains the specific variables that airblade needs, and adds on to (or overrides) different variables already set in config.prc, which contains the generic variables that everyone probably wants.


Right. But for me, the fastest way to enable/disable/switch between configs setting while the project is under development is putting those changes in the main script. So I can simply jump to the top of it and make adjustments for particular testing purposes, and then run it immediately, without any need to open the config file all the time, or looking around when I need it.
The permanent changes then can be saved to the project’s config file once the project completed.