Resizing my Browser window (not the canvas)

39 views
Skip to first unread message

Don Warr

unread,
Jun 14, 2024, 9:04:38 PMJun 14
to VPython-users
Scenario: I have a Vpython program... When I Run the program, It opens a localhost on my                 computer  browser, and the browser opens and I see the objects wonderfully..

But the Browser window covers my hole monitor screen..  and Yes, from my window I could resize the browser window,,, but I need to be able to program the size within the Vpython program.... 

Any comment's or help on this would be vary much Appreciated... Thanks

John

unread,
Jun 15, 2024, 5:20:07 AMJun 15
to VPython-users
Vpython uses the webbrowser package to launch a browser.


In this documentation it talks about setting up an environment variable called BROWSER containing the path to your browser and %s. You could try adding --window-size=800,600 and --window-position=200,300 flags to the command line for the position and size of the browser window you want.  

You can launch a browser with a command like 

"C:\Program Files\Google\Chrome\Application\chrome.exe" --window-position=800,600 --window-position=200,300 

and then try add a %s to this command in and put in in the BROWSER environment variable on your computer. Then run vpython program and see if it opens the browser with the size and location you specified in BROWSER environment variable.

John

unread,
Jun 16, 2024, 2:03:38 PMJun 16
to VPython-users
As an alternative here is a Browser extension that you can add to google chrome browser to resize the window.


You can enter any size window you want into a list and then just select it from the list to resize the browser window containing vpython display output.

Don Warr

unread,
Jun 17, 2024, 1:48:47 PMJun 17
to VPython-users
Well Thank you John,,,,, I will now start to investigate in the areas you have shown.... The goal here
is to open a vpython display inside visual studio window form as a much bigger project..(If I can live long enough)lol...

Reply all
Reply to author
Forward
0 new messages