Set frame size

Hi Panda community,

I started scripting with Panda3D engine some day before, but I have already a lot of experience in Python =)

My very first question is, how I can set the size of the main frame. So a play can not change the size of my game!

Thanks a lot!

Rennnyyy

What do you mean by “main frame”? Are you talking about the game’s window?

Yeah =D The GUI that implements the “DirectObject” class =)

I’m sorry for my choose of words, but I normaly script GUI based things, so for me it’s the main frame =D

Hi Rennnyyy,

You can do something like this at the very top of your python file:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'win-size 800 600') #- The window size you would like
loadPrcFileData('', 'win-fixed-size #t') #- Specify that the window is a fixed size (non resizeable)

#- Then you can import DirectStart and DirectObject (which opens the main window) (or "frame")
from direct.directbase import DirectStart
from direct.showbase.DirectObject import DirectObject

Hope this helps,
~powerpup118

I’m sorry, that does not work.

My code:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'win-size 800 600') #- The window size you would like
loadPrcFileData('', 'win-fixed-size #t') #- Specify that the window is a fixed size (non resizeable) 

from Objects import *
from Constants import *

import direct.directbase.DirectStart
from panda3d.core import Point2,Point3,Vec3
from direct.showbase.DirectObject import DirectObject

class GUI(DirectObject):
    def __init__(self):
        
        base.disableMouse()
        
        self.bg = loader.loadModel('models/all')
        self.bg.reparentTo(PARENT)   
        self.bg.setPos(Point3(0,DEEP,7))   
        self.bg.setScale(44)   
        self.bg.setBin('background', 0)
        self.bg.setDepthTest(False)
        self.bg.setTexture(loader.loadTexture('textures/background.png'), 1) 
    
        self.board = Board(7,6)
        self.objectList = []
              
g = GUI()
run()

What does not work about it? Is the window not 800x600 in size?

I saw that the resolution is set perfectly. But you can resize it Oo

Well, it works for me on Ubuntu 10.04, running Gnome…
What OS and (if Linux) what window manager are you running?

Eg.
Windows
Mac
Linux with Gnome/KDE
Perhaps panda is yet to support fixed-size with your window manager?

~powerpup118

I’m using Win XP Home 32 bit

Maybe you’re right!

I could be very wrong, viewing this thread appears to show that…

It’s a bug that was fixed in the newest 1.7.1 version of panda on Windows XP

You may have to wait until 1.7.1 is released officially, or use the snapshot builds of 1.7.1 found here

Oh thanks. I let the code like it is and download newest version, when it is stable =)

I tried using the code provided on a Windows 7 64-bit machine, and it did not prevent resizing. This is the exact snipped I used (at the top of the .py file, before DirectStart:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'win-size 1024 640')
loadPrcFileData('', 'win-fixed-size #t')

Are we sure this is merely a Windows XP 32-bit issue?

As the linked thread indicates, this is a bug in 1.7.0, but should work in the buildbot version.

David