Opening other Python 3 files using tkinter [duplicate] - python

This question already has answers here:
How do you run your own code alongside Tkinter's event loop?
(5 answers)
Closed 6 years ago.
I am currently working on making a program using tkinter that when pressing a button it opens the Python program, however I am having some problems with it. I have tried using os.system('filename.py'). That opens the file, but then crashes the GUI, making the user have to restart the GUI. I have also tried importing it as a module but that just does the same as when using os.system.
Can anyone possibly help me open a Python file in a completely new window/terminal?

The problem is filename.py will not be recognised by your os.
Instead of that use:
os.system('python filename.py')
This will successfully open your python file inside your GUI
Hope this helps

Related

Pygame Code screen keeps opening with game [duplicate]

This question already has answers here:
How to hide console window in python?
(10 answers)
Closed 3 years ago.
My team and I implemented a game in Python using Pygame. Whenever the game is run, alongside the GUI there is an extra black window that opens alongside, a .exe window. Is there anyway to stop it from opening?
That is a command window, specifically one running python[Version Number].exe. To remove it simply change the scripts file extension to .pyw instead of .py, which changes the file type to the same thing [Python], but without the console window opening too.
So for example, script.py would become script.pyw

Is there any way of removing the command prompt shell in python? [duplicate]

This question already has answers here:
Run Python script without Windows console appearing
(11 answers)
Closed 5 years ago.
I am currently learning Python and I am working through a project in a book entitled Python Crash Course. The project involves developing a game called "Alien Invasion". In the process of running the game, it opens a 'window' area where the action occurs while keeping a command prompt shell open. At least to me, it seems tacky to have a command prompt shell open. I am thinking about developing some games and I want to have a professional look to them. Is there any way of automatically closing the command prompt shell close after a program compiled in Python has started?
If you are opening your program on IDLE, I believe it is not possible to not have the Shell window open as it is the main window for any sort of system output like errors. However, to make your game look more professional, you can use py2exe or py2app (Mac OS X). This will help you turn your program into an executable file that is also portable. Also, when you open your executable game window, there will be no Shell window opening.

How do I stop the command prompt from appearing when I run my Python executable? [duplicate]

This question already has answers here:
Hiding console window of Python GUI app with py2exe
(4 answers)
Closed 7 years ago.
I compiled a Python GUI program using py2exe, and it works, but when I run it the command prompt appears in addition to my program window. I have read that I should change the python.exe file to the pythonw.exe file, but there isn't even a Python.exe file in the dist folder to begin with. Compiling a .pyw version of the file also does not fix this. How would I prevent this from happening?
Duplicate
You didn't post any code (which you should do), but I suspect you're using "console" instead of "windows" in setup.py.

Is it possible to make python into an executable file? [duplicate]

This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 9 years ago.
Is there a way to make python an executable file on a mac, windows, or unix?
Nothing fancy in a GUI, but open a terminal window or a console window and run like somebody executed the application through terminal.
If there's no easy way to do this, can someone direct me to any reading material? Thank you!
You can use PyInstaller (http://www.pyinstaller.org/), there is also py2exe (http://www.py2exe.org/).
My experiences with PyInstaller on Linux show that it tends to place a lot of shared libs which may sometimes clash with your distribution so it's sometimes necessary to trim it down a bit afterwards.

Python script pops up console when run by scheduler [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Run python script without DOS shell appearing
I have a python script that Windows Scheduler runs every 5 minutes for me. The script works fine but every time it runs it's loading up the console really quick on my desktop before it automatically closes. Does anyone know how to remove this behavior? I'd like it to just run in the background without me knowing.
Run it through pythonw instead of python (pyw if you're using the new launcher).

Categories

Resources