I've been trying to open a graphical user interface through the command line in Python 3.7. I was just wondering how I would do this? How do I access the file it's located in? Do I copy and paste the file (C:\Users...) and run python ui.py through it?
Thank-you.
82 Answers
You could use the command line rather than the python terminal
cd into the directory of the project and then run python ui.py.
Copying the file to another directory may break the program as it could rely on other files in its project directory.
If you really want to stay in the python terminal you could
> import os > os.chdir(PATH_TO_FILE) then run the file as normal
hope this helps
2If you are trying to view python file from command line, open command line and use cd
for me I have my python scripts in a folder on my Dekstop so I would put:
C:\Users\YourName>cd Desktop C:\Users\YourName\Desktop>cd Python C:\Users\YourName\Desktop\Python>"Your Python Code Name Goes Here.py"