2

I made a python code which executes polygon.exe program like this:

    import os

    makecommand = "polygon -e 25 -l 25 pri 6 > hexagon.off"
    os.system(makecommand)

Then black cmd window pops up which implies that the polygon.exe program is working well. Now, I want to hide the black cmd window that pops up when I run the python code.

I also tried using subprocess like this,

    import subprocess

    makecommand = "polygon -e 25 -l 25 pri 6 > hexagon.off"
    subprocess.run(makecommand)

but then the polygon.exe program was not executed and the wanted hexagon.off file was missing.

Is there any way to hide the black cmd window popping up in Python when programs are executed? (For your information, polygon.exe program is a part of Antiprism project.)

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
현규박
  • 21
  • 1

1 Answers1

1

if you want to hide the cmd when you execute the python file you just need to rename it to file.pyw

Kal-1
  • 177
  • 1
  • 9