0

I'm just wondering (as im starting to make a game with pygame) is there a way to 1) Run a program that only opens a GUI and not the shell and 2) Run the program without having to edit with idle (I'd like to do this so the game will look more professional.

I would like to just have a desktop shortcut or something that when clicked, runs only the GUI and doesnt show my code or show the shell.

finlx
  • 89
  • 9
  • Is such behaviour not operating system dependent? What are you using? – mvw Sep 24 '15 at 21:49
  • related: [How to hide console window in python?](http://stackoverflow.com/q/764631/4279) – jfs Sep 24 '15 at 23:18
  • Developing a pygame game with Idle is fine (worked great for my child), but once developed, run it directly with python or, on Windows, pythonw.exe, as Dval said. – Terry Jan Reedy Sep 25 '15 at 05:19

1 Answers1

1

If you're on windows, a quick thing could be to make a one-line batch script.

start pythonw.exe <filename>

The start keyword causes the shell to not wait for the program to finish. pythonw vs python prevents the python terminal from appearing.

If you're on linux/mac, you could do the same with shell scripts.

Dval
  • 352
  • 1
  • 10
  • Thanks! Sorry im not a high enough level to upvote but thanks anyway! – finlx Sep 24 '15 at 22:11
  • @finlx: if you use `.pyw` file extension for your Python script then double-clicking on it should use `pythonw.exe` automatically. You can always specify the necessary command in a desktop shortcut; no need to create a bat-file (google "create desktop shortcut"). – jfs Sep 24 '15 at 23:21
  • @J.F.Sebastian Thanks as well! Just wondering, if i use this method will it open in cmd or will it open in idle? – finlx Sep 25 '15 at 01:05
  • @finlx: neither. It runs `pythonw.exe` directly (that runs your script.py) – jfs Sep 25 '15 at 01:15