0

Im working in a simple idle game in python and its interface is made trought PySimplegui, then it came to me two questions:

  1. How do i transform my python code into an executable file?

  2. There is any way to make my code become an Android application? if yes, how?

RRonan
  • 1
  • 1

2 Answers2

0
  1. There are many solutions available. You might want to look at py2exe.
  2. I'm not sure if you can turn a python program into an android program. PySimpleGUI doesn't work with android.
sybrg
  • 199
  • 7
0
  1. There's a very simple solution to this. Use the PyInstaller module to convert your python script to an executable file. The best thing about PyInstaller is that it will fetch all your dependencies and stack all these to an executable file. You can follow this simple line of code from your script directory in your command prompt pyinstaller --onefile -w [your_script_name.py]

You can also watch this video, this guy explains it pretty well : https://youtu.be/UZX5kH72Yx4 Also here's the PyInstaller manual: https://pyinstaller.readthedocs.io/en/stable/index.html

  1. Now to convert into .apk file, to the best of my knowledge I don't think you can directly convert your python script to .apk. I would recommend using KIVY to build an android app by python. I am sharing a tutorial here though I don't know how good this is, you can check for yourself: https://youtu.be/mUdnjNGePZw
Musabbir Arrafi
  • 744
  • 4
  • 18
  • i tired what you said for the first question, but when i click the .exe it says 'failed to execute script' – RRonan Mar 12 '21 at 19:58
  • [Check out this post](https://stackoverflow.com/questions/40716346/windows-pyinstaller-error-failed-to-execute-script-when-app-clicked) -- @RRonan . Looks like this guy faced the same problem as you did. – Musabbir Arrafi Mar 13 '21 at 15:03