ditus
January 29, 2010, 4:45am
1
why is this not working?
def window():
winX = str(getCONF.getCONF()[0]) #here im receiving the x resolution
winY = str(getCONF.getCONF()[1]) #here im receiving the y resolution
winFULL = str(getCONF.getCONF()[2]) #and here 1 or 0 for fullscreen
win = str('"""'+"fullscreen "+ winFULL+' win-size '+winX+" "+winY+'"""')
return win
from pandac.PandaModules import loadPrcFileData
loadPrcFileData(window())
greetz
dirk
adr
January 29, 2010, 7:22am
2
You need to request them too…
base.win.requestProperties(win)
rdb
January 29, 2010, 12:28pm
3
I don’t think you can load these prc variables after the window has already opened. You should use WindowProperties indeed, as adr said.
ditus
January 29, 2010, 12:43pm
4
no rdb, i tried to open the window with setting the prc by using a string.
it looked that way:
from config import getCONFIG
getCONF = getCONFIG()
##################
#set windows size#
##################
def window():
winX = str(getCONF.getCONF()[0])
winY = str(getCONF.getCONF()[1])
winFULL = str(getCONF.getCONF()[2])
win = str('"""'+"fullscreen "+winFULL+' win-size '+winX+" "+winY+'"""')
return win
from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", window())
import direct.directbase.DirectStart
from pandac.PandaModules import NodePath,TextNode
from pandac.PandaModules import Point3,Vec3,Vec4,VBase4
thanks adr, now its working!
but im still curious, why i cant set the prc var by using a string?
now it looks that way->
##################
#set windows size#
##################
def window(self):
winX = int(getCONF.getCONF()[0])
winY = int(getCONF.getCONF()[1])
winFULL = str(getCONF.getCONF()[2])
win = WindowProperties()
win.setSize(winX,winY)
win.setFullscreen(winFULL)
base.win.requestProperties(win)
rdb
January 29, 2010, 12:58pm
5
Ah, I see. You forgot the newlines. And those triple quotation marks shouldn’t be there either. Try something like this:
win = "fullscreen "+ winFULL+'\nwin-size '+winX+" "+winY
Or, better readable:
win = "fullscreen %s\nwin-size %s %s" % (winFULL, winX, winY)