HybExe Framework makes it simple to create cross-platform desktop applications using Python.
Watch On GitHubHybExe Framework comes with a simple and intuitive syntax that allows you to quickly build desktop apps with ease.
Build desktop apps that work on multiple platforms, including Windows, macOS, and Linux.
Package your app as a standalone executable for easy distribution and installation on user's systems.
Before using HybExe Framework, make sure you have Python installed on your system. You can download the latest version of Python from the official website.
Start by cloning the HybExe GitHub repository to your local machine using the following command:
$ git clone https://github.com/tj-likes-coding/hybexe.git
$ cd hybexe
To isolate the dependencies for your HybExe project, create a virtual environment using Python's built-in venv module.
$ python -m venv venv
Activate the virtual environment to ensure that the packages are installed in the isolated environment.
$ source venv/bin/activate (On macOS and Linux)
$ venv\Scripts\activate (On Windows)
Use pip to install the necessary packages listed in the requirements.txt file for HybExe framework.
$ pip install -r requirements.txt
Run the program without having to build again and again.
$ python main.py
A lightweight cross-platform library to display web-based GUIs in desktop applications.
Freeze (package) Python programs into stand-alone executables for various platforms.
Access features on mobile devices, such as notifications and vibrations, through a unified API.
from modules.browser import createWindow
from modules.back import back
from modules.notification import notify
def func(data):
back.send("Hi", "Hello from back!")
back.on(event="Bye", callback=func)
window = createWindow(title="Hello World", url="./src/index.html", resizable=True, draggable=True, text_select=True)
def start():
notify("Hello There", "Cool", "", 10)
back.send("Bye", "Cool")
window.start(function=start, debug=False)
To create a standalone executable for your hybrid desktop app, make sure to include the src
and image
folders in the datas array of the main.spec
file. Open the main.spec
file and modify the datas array as shown below:
a = Analysis(['main.py'],
pathex=['path/to/your/app'],
binaries=[],
datas=[
('path/to/your/app/src', 'src'),
('path/to/your/app/image', 'image')
],
# ... (Other configurations)
)
After updating the main.spec
file, you can run the following command in the terminal or command prompt to build the standalone executable:
$ pyinstaller main.spec --clean
The --clean
option will remove any previously generated build files before building.
After the build process completes, you will find the standalone executable in the dist
directory. This executable can be distributed and run on other systems without the need for Python or any dependencies.
To create an installer for your standalone executable, you can use NSIS (Nullsoft Scriptable Install System). If you don't have NSIS installed, download and install it from the official website.
After installing NSIS, create a new text file named installer.nsi
and add the following script:
# Define the installer name and output directory
Outfile "MyAppInstaller.exe"
InstallDir $PROGRAMFILES\MyApp
# Default section
Section
SetOutPath $INSTDIR
File "path/to/your/app/dist/YourApp.exe"
# Add any other necessary files to be installed
SectionEnd
# Uninstaller section
Section "Uninstall"
RMDir /r $INSTDIR
# Additional uninstallation steps
SectionEnd
Replace MyAppInstaller.exe
with your desired installer name and update the paths accordingly.
Save the script and run the following command in the terminal or command prompt:
$ makensis installer.nsi
The above command will compile the script and create the installer file. Once the process completes, you will have your installer ready for distribution.
You can manage the version settings of your HybExe framework in the version.rc
file. This file allows you to specify the version number and other relevant details for your application.
VSVersionInfo(
ffi=FixedFileInfo(
# Set version numbers
filevers=(1, 0, 0, 0),
prodvers=(1, 0, 0, 0),
# Set file flags (usually 0)
mask=0x3fL,
flags=0x0L,
# Set OS, file type, and subtype (usually 0)
OS=0x40004L,
fileType=0x1L,
subtype=0x0L,
# Set date and time (usually 0)
date=(0, 0)
),
kids=[
StringFileInfo(
[
StringTable(
u'040904b0',
[StringStruct(u'CompanyName', u'Your Company Name'),
StringStruct(u'FileDescription', u'Your Application Description'),
StringStruct(u'FileVersion', u'1.0.0.0'),
StringStruct(u'ProductVersion', u'1.0.0.0'),
StringStruct(u'InternalName', u'YourApplicationName'),
StringStruct(u'OriginalFilename', u'YourApplicationName.exe'),
StringStruct(u'ProductName', u'Your Application Name'),
StringStruct(u'ProductVersion', u'1.0.0.0')])
]
),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]
)
Update the relevant fields in the version.rc
file with your application's details. These settings will be reflected in the properties of the standalone executable and the installer.
Congratulations! You've learned how to create a hybrid desktop app using HybExe.
Explore the documentation and have fun building amazing cross-platform applications with the HybExe framework!
If you encounter any issues or have questions, don't hesitate to reach out to us.
Happy coding and distributing! 😎🚀