pysimplegui-exemaker
This commit is contained in:
parent
5c6aad4271
commit
495bdb5eec
|
@ -0,0 +1 @@
|
|||
name = "pysimplegui-exemaker"
|
|
@ -0,0 +1,77 @@
|
|||
import PySimpleGUI as sg
|
||||
import subprocess
|
||||
from shutil import copyfile
|
||||
import shutil
|
||||
import os
|
||||
|
||||
def Launcher():
|
||||
sg.ChangeLookAndFeel('LightGreen')
|
||||
|
||||
layout = [[sg.T('PyInstaller EXE Creator', font='Any 15')],
|
||||
[sg.T('Source Python File'), sg.In(key='_sourcefile_', size=(45,1)), sg.FileBrowse(file_types=(("Python Files", "*.py"),))],
|
||||
[sg.T('Icon File'), sg.In(key='_iconfile_', size=(45,1)), sg.FileBrowse(file_types=(("Icon Files", "*.ico"),))],
|
||||
[sg.Frame('Output', font='Any 15',layout= [[sg.Output(size=(85, 15), font='Courier 10')]])],
|
||||
[sg.ReadFormButton('Make EXE',bind_return_key=True),
|
||||
sg.SimpleButton('Quit', button_color=('white','firebrick3')),]]
|
||||
|
||||
window = sg.Window('PySimpleGUI EXE Maker',
|
||||
auto_size_text=False,
|
||||
auto_size_buttons=False,
|
||||
default_element_size=(20,1),
|
||||
text_justification='right')
|
||||
|
||||
window.Layout(layout)
|
||||
|
||||
# ---===--- Loop taking in user input --- #
|
||||
while True:
|
||||
(button, values) = window.Read()
|
||||
if button is 'Quit' or button is None:
|
||||
break # exit button clicked
|
||||
|
||||
source_file = values['_sourcefile_']
|
||||
icon_file = values['_iconfile_']
|
||||
|
||||
icon_option = '-i "{}"'.format(icon_file) if icon_file else ''
|
||||
source_path, source_filename = os.path.split(source_file)
|
||||
workpath_option = '--workpath "{}"'.format(source_path)
|
||||
dispath_option = '--distpath "{}"'.format(source_path)
|
||||
specpath_option = '--specpath "{}"'.format(source_path)
|
||||
folder_to_remove = os.path.join(source_path,source_filename[:-3])
|
||||
file_to_remove = os.path.join(source_path, source_filename[:-3]+'.spec')
|
||||
command_line = 'pyinstaller -wF "{}" {} {} {} {}'.format(source_file, icon_option, workpath_option, dispath_option, specpath_option)
|
||||
|
||||
if button is 'Make EXE':
|
||||
out=''
|
||||
try:
|
||||
print(command_line)
|
||||
print('Making EXE... this will take a while.. the program has NOT locked up...')
|
||||
window.Refresh()
|
||||
# print('Running command {}'.format(command_line))
|
||||
out, err = runCommand(command_line)
|
||||
shutil.rmtree(folder_to_remove)
|
||||
os.remove(file_to_remove)
|
||||
print('**** DONE ****')
|
||||
except:
|
||||
sg.PopupError('Something went wrong', 'close this window and copy command line from text printed out in main window','Here is the output from the run', out)
|
||||
print('Copy and paste this line into the command prompt to manually run PyInstaller:\n\n', command_line)
|
||||
|
||||
|
||||
def runCommand(cmd, timeout=None):
|
||||
""" run shell command
|
||||
|
||||
@param cmd: command to execute
|
||||
@param timeout: timeout for command execution
|
||||
|
||||
@return: (return code from command, command output)
|
||||
"""
|
||||
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
output = ''
|
||||
|
||||
out, err = p.communicate()
|
||||
p.wait(timeout)
|
||||
|
||||
return (out, err)
|
||||
|
||||
if __name__ == '__main__':
|
||||
Launcher()
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# PySimpleGUI-HowDoI
|
||||
|
||||
## Introduction
|
||||
This package contains a GUI front-end to PyInstaller. Use this tool to create EXE files from your python programs
|
||||
|
||||
![snag-0086](https://user-images.githubusercontent.com/13696193/46968655-c2103200-d081-11e8-926f-d5f977e726f3.jpg)
|
||||
|
||||
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
When you install PySimpleGUI-HowDoI, it will install the other components that it requires. To install, on windows, type this into a command prompt:
|
||||
|
||||
pip install pysimplegui-exemaker
|
||||
|
||||
|
||||
## PySimpleGUI Project
|
||||
|
||||
This program was built as a sample application of the PySimpleGUI GUI Framework.
|
||||
|
||||
|
||||
## Running the program
|
||||
|
||||
After your pip install, type this into your command prompt:
|
||||
|
||||
python -m pysimplegui-exemaker.pysimplegui-exemaker
|
|
@ -0,0 +1,27 @@
|
|||
import setuptools
|
||||
|
||||
with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="pysimplegui-exemaker",
|
||||
version="1.0.0",
|
||||
author="PySimpleGUI.org",
|
||||
author_email="info@PySimpleGUI.org",
|
||||
description="A GUI Front-end to PyInstaller",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
install_requires=['PyInstaller', 'pysimplegui'],
|
||||
url="https://github.com/MikeTheWatchGuy/PySimpleGUI",
|
||||
packages=setuptools.find_packages(),
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: Microsoft :: Windows ",
|
||||
],
|
||||
)
|
Loading…
Reference in New Issue