WebUI is a free and open source GUI library that use any installed web browser as your user interface. Basically you can transform an basic console app or any Python script to a nice GUI application, in a easy way.
First, web technologies is everywhere now, and web browsers today have everything a modern UI need, your application will look nicer and multi-platform.
Basically this library use latest web server and WebSocket standards to maintaine the communication in binary mode between the web browser (UI) and your application. You receive any click events, and of course you can send data or executing JavaScript code.
- Include one header file:
#include <webui/webui.hpp>
- Set your HTML code
const std::string html = R"V0G0N(
<!DOCTYPE html>
<html>
<head>
<title>My first WebUI app</title>
</head>
<body>
<h1>Welcome to WebUI!</h1>
<button id="MyButtonID">Click on me!</button>
</body>
</html>
)V0G0N";
- Create a window object
webui::window my_window(&html);
- Create your handler function
void my_handler(webui::event e){
std::cout << "You clicked on a button!" << std::endl;
}
- Bind your HTML element with your handler function
my_window.bind("MyButtonID", my_handler);
- Show the window!
my_window.show();
- Make infinit loop and wait for all windows to close
std::thread ui(webui::loop);
ui.join();
You can also show the window using a specific web browser
if(!my_window.show(webui::browser::firefox)) // If Firefox not installed
my_window.show(); // then try other web browsers.
def my_function():
print('You clicked on the first button!')
def my_function_two():
print('You clicked on the second button!')
# Create a window object
MyWindow = WebUI()
# Bind am HTML element ID with a python function
MyWindow.bind('MyButtonID1', my_function)
MyWindow.bind('MyButtonID2', my_function_two)
# Show the window
MyWindow.show(my_html)
# Wait unitil all windows are closed
MyWindow.loop()
print('Good! All windows are closed now.')
sys.exit(0)
Please see examples folder.
- C++ 20
- Lightweight and fast binary mode communication
- One header file
- Multiplatform & Multi Browser
- Private user browser profiles
- Customized app mode look & feel
OS | Browser | Status |
---|---|---|
Windows | Firefox | Supported |
Windows | Chrome | Supported |
Windows | Edge | Supported |
Linux | Firefox | Supported |
Linux | Chrome | Supported |
macOS | Firefox | Supported |
macOS | Chrome | Supported |
macOS | Safari | Under development |
- Goto http://webui.me and download latest release WebUI library.
- [ ! ] Microsoft Visual Studio 2017 is not supported.
- Windows SDK 10x. You can download it from http://microsoft.com
- Microsoft Visual Studio 2019 (or build tools 2019).
- CMake +3.13.0. You can download it from https://cmake.org/download
- Boost +1.76
- Python 3.8 (only if you want cWebUI).
- First make sure you have Boost +1.76 MSVC version (https://sourceforge.net/projects/boost/files/boost-binaries/1.76.0/boost_1_76_0-msvc-14.2-64.exe/download)
git clone https://github.com/alifcommunity/webui.git
cd webui
mkdir build
cd build
Generate Visual Studio 2019 solution
cmake .. -G "Visual Studio 16 2019" -DBOOST_ROOT=C:/local/boost_1_76_0 -DBOOST_LIBRARYDIR=C:/local/boost_1_76_0/lib64-msvc-14.2 -DCMAKE_BUILD_TYPE:STRING=Release
Generate Makefile for Microsoft Visual Studio build tools 2019.
cmake .. -G "NMake Makefiles" -DBOOST_ROOT=C:/local/boost_1_76_0 -DBOOST_LIBRARYDIR=C:/local/boost_1_76_0/lib64-msvc-14.2 -DCMAKE_BUILD_TYPE:STRING=Release
nmake
Build cWebUI
nmake cwebui
git clone https://github.com/alifcommunity/webui.git
cd webui
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
mingw32-make
- C++20 compiler (GCC/Clang):
sudo apt install build-essential
- Boost lib +1.70.0:
sudo apt install libboost-all-dev
- CMake +3.15.0:
sudo apt install cmake
- Python 3.8 (only if you want cWebUI).
git clone https://github.com/alifcommunity/webui.git
cd webui
mkdir build
cd build
cmake ..
make
sudo make install
Build cWebUI if needed
make cwebui
- Clang
- [!] Comming soon!
GNU General Public License v3.0