简体   繁体   中英

How do I make a 800x800 console window with python

我最近在 python 3.9 中制作了一个简单的基于文本的游戏,我想这样做,所以当你运行 .exe 时,它​​会打开一个 800x800 或我想放入的任何比例的控制台窗口。谁能帮我做这个请!

The only option that i can think of its to run tour program in PowerShell , this one can resize it self with something like this

$pshost = get-host
$pswindow = $pshost.ui.rawui
$newsize = $pswindow.buffersize
$newsize.height = 3000
$newsize.width = 150
$pswindow.buffersize = $newsize
$newsize = $pswindow.windowsize
$newsize.height = 50
$newsize.width = 150
$pswindow.windowsize = $newsize

I get this code from here

You can call this commands inside python with OS module.

I couldnt test the code cause #teamLinux .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM