Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

None Command Line Applications

Questions fairly self explanatory, all the projects I've made so far have been using command line (I'm on OOP Python in the Python track) what if I don't want my program to be reliant on a command prompt? I'm asking for a few reasons, A) because I'm running on Windows and the Windows command line doesn't work with any of the Python projects I've made for treehouse (I eventually plan to add Linux to an external drive and then my computer can be Linux and Windows which leaves me to reason B) B) because when I make projects on my own I plan to make them run on multiple OS's and computers and having them be command line apps would limit that. Any help would be appreciated thanks!

1 Answer

You could make the apps using kivy or tkinter and then package them using pyinstaller. Kivy and Tkinter allow you to make GUIs. You can then package the files into an executable that can be run on any machine (with the same operating system as the system that made the package. i.e. if you are running windows on the computer that you make the executable, then the executable will run on windows machines). This will make the interface much easier for the user rather than using the command line. Also, do you have your PATH environment variable set so that you can use python straight from cmd (wasn't sure what you meant by command line not working). I could go into some more detail if I am answering your question properly (just in case I've misunderstood anything, so I don't write too much if I'm on the wrong track).

No you gave a great answer thank you! I don't know how my PATH is set up I followed the instructions from Kenneth Love's video on setting up a local Windows Python environment... And also thanks for suggesting Kivy and Tkinter I I'll check them out!

I checked out the Kivy and Tkinter, they both talk about Python. What if my project contains files using C# or any other language along with Python can they still be made into executables and have GUI's?

Go to control panel and click system. Click Advanced System Settings. Click Environment Variables. Append ;C:\python34 to the Path variable. Restart Command Prompt.

Change the '34' to whatever version you are using (if you're using Python 3.5 then it would be 35 or 27 for Python 2.7). Python 3.5 for windows now has this option as a checkbox during installation, but I didn't see it for Python 3.4 (full disclosure I'm on a Mac). I'm not sure about making an executable with both C# and Python (I'm still new at Python). If the way you are using them both is like Kivy (Kivy kind of has its own language for kv files that can be used) where you can reference the files then maybe it would work similarly where it will package it all together (you may have to move the C# files into the executable files manually at the end (on Mac I have to put my kv files and images into the application I've created once I've run pyinstaller). Another option would be to try to do it all in Python, but that would probably take a while if it is possible, so it would probably be easier to find a way to use several languages and still be able to package them. If you go on Kivy's github and Pyinstaller's github and ask them on their issues page, they may know how to implement this. Or Stackexchange (since it's not really an issue so much as looking for a way to do it). Don't have much more information than that on combining languages (even though I know visual C# and Python, I haven't looked into using them both together yet).