fullscreen toggle

I am using this code to accomplish fullscreen:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", "fullscreen 1")
import direct.directbase.DirectStart 

However, I want the user to have the choice. So how to I switch between fullscreen and windowed, during game-play?

Also what code can I use to find the resolution on a pc, so that I can set the game to change its window size accordingly?

Search the code snippet forum, and read the comments carefully.

OK I’ll do a search.

OK I’ll do a search.

OK I’ll do a search.

OK I’ll do a search.

wow lots of searching…

Sorry.
I received an error when I posted, and did not know it was sent.
I found the your post ynjh_jo
I get this error when I use the code:

TypeError: Cannot call WindowProperties.setFullscreen() on a const object.

Use the latest one. It happened to me too in my grad exam, embarassing.

Jillinger, right, that has changed in a certain version of Panda3D. Instead of grabbing the properties from the window every time, create a new WindowProperties instance, and set the properties you need on that, then have base.win request it.
As ynjh_jo said, find the latest post on that.

Thanks