Загрузка...

Converter to .exe file and .exe file with logo

Thread in Python created by dastt Mar 12, 2023. (bumped Mar 12, 2023) 186 views

  1. dastt
    dastt Topic starter Mar 12, 2023 2 Mar 1, 2023
    Python
    import os

    vopros = str(input('1: no logo\n2: Yes logo\nNumber:'))

    if vopros == '1':
    baran = str(input('Name .py file (.py -> .exe): '))
    os.system(f'pyinstaller -F {baran}.py')
    print('Your .exe file -> dist \n by @matliteoff')

    elif vopros == '2':
    baran = str(input('Name .py file (.py -> .exe): '))
    logo = str(input('Name .ico file: '))
    os.system(f'pyinstaller -F -w -i {logo}.ico {baran}.py')
    print('Your .exe file -> dist \n by @matliteoff')
    Код простой, сделал для облегчения вам​
     
    1. Kotegawa1Kamikot
      dastt, а наxуй ты велосипед изобретаешь, если есть py2exe?
    2. dastt Topic starter
  2. Shemdy
    review:

    Python
    import os

    def main():
    logo_choice = get_logo_choice()
    py_file = get_py_file_name()

    if logo_choice == '1':
    create_exe(py_file)
    elif logo_choice == '2':
    icon_file = get_icon_file_name()
    create_exe_with_logo(py_file, icon_file)

    def get_logo_choice():
    while True:
    logo_choice = input('1: no logo\n2: Yes logo\nNumber:')
    if logo_choice in ['1', '2']:
    return logo_choice
    print('Please enter 1 or 2.')

    def get_py_file_name():
    while True:
    py_file = input('Name .py file (.py -> .exe): ')
    if py_file.endswith('.py'):
    return py_file[:-3]
    print('Please enter a .py file.')

    def get_icon_file_name():
    while True:
    icon_file = input('Name .ico file: ')
    if icon_file.endswith('.ico'):
    return icon_file[:-4]
    print('Please enter an .ico file.')

    def create_exe(py_file):
    os.system(f'pyinstaller -F {py_file}.py')
    print('Your .exe file -> dist\nby @matliteoff')

    def create_exe_with_logo(py_file, icon_file):
    os.system(f'pyinstaller -F -w -i {icon_file}.ico {py_file}.py')
    print('Your .exe file -> dist\nby @matliteoff')

    if __name__ == '__main__':
    main()
     
    1. dastt Topic starter
      Shemdy, воды много(
    2. derkown
      dastt, это не вода, это нормальный код
  3. 0987654323456789
    [IMG]и куда оно сохраняется
     
Top
Loading...