All Projects → keybraker → Python Gui Electron

keybraker / Python Gui Electron

Licence: gpl-3.0
A simple example on how to create electron GUIs for python programs

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Python Gui Electron

Goluwa
a game framework written in luajit
Stars: ✭ 173 (-6.49%)
Mutual labels:  gui
Uivonim
Fork of the Veonim Neovim GUI
Stars: ✭ 172 (-7.03%)
Mutual labels:  gui
Qt5.cr
Qt5 bindings for Crystal, based on Bindgen
Stars: ✭ 182 (-1.62%)
Mutual labels:  gui
Dottorrent Gui
An advanced GUI torrent file creator with batch functionality, powered by PyQt and dottorrent
Stars: ✭ 175 (-5.41%)
Mutual labels:  gui
Generative And Discriminative Voxel Modeling
Voxel-Based Variational Autoencoders, VAE GUI, and Convnets for Classification
Stars: ✭ 179 (-3.24%)
Mutual labels:  gui
Robot Gui
A three.js based 3D robot interface.
Stars: ✭ 181 (-2.16%)
Mutual labels:  gui
Gtk Fortran
A GTK / Fortran binding
Stars: ✭ 171 (-7.57%)
Mutual labels:  gui
Clog
CLOG - The Common Lisp Omnificent GUI
Stars: ✭ 181 (-2.16%)
Mutual labels:  gui
Gwork
Skinnable GUI with useful widget collection. Fork of GWEN.
Stars: ✭ 179 (-3.24%)
Mutual labels:  gui
Phantomstyle
Cross-platform QStyle for traditionalists
Stars: ✭ 179 (-3.24%)
Mutual labels:  gui
Lifeboat
Docker Compose UI: Lifeboat is an easy way to launch projects with a graphical interface
Stars: ✭ 176 (-4.86%)
Mutual labels:  gui
Awtk
AWTK = Toolkit AnyWhere(为嵌入式、手机和PC打造的通用GUI系统)
Stars: ✭ 2,328 (+1158.38%)
Mutual labels:  gui
Pandasgui
PandasGUI is a GUI for viewing, plotting and analyzing Pandas DataFrames.
Stars: ✭ 2,495 (+1248.65%)
Mutual labels:  gui
Xerror
fully automated pentesting tool
Stars: ✭ 173 (-6.49%)
Mutual labels:  gui
Migrate Windowsuserprofile
Migrate Windows user profile to a new machine using Microsoft USMT with a PowerShell GUI.
Stars: ✭ 182 (-1.62%)
Mutual labels:  gui
Visbrain
A multi-purpose GPU-accelerated open-source suite for brain data visualization
Stars: ✭ 172 (-7.03%)
Mutual labels:  gui
Webgui
An example demo of IMGUI (Immediate Mode GUI) on the web. Using only WebGL, GLFW and ImGui. Suitable for being compiled to web assembly (WASM).
Stars: ✭ 180 (-2.7%)
Mutual labels:  gui
Nibbler
Nibbler - Leela Chess Zero (Lc0) interface
Stars: ✭ 185 (+0%)
Mutual labels:  gui
Nussknacker
Process authoring tool for Apache Flink
Stars: ✭ 182 (-1.62%)
Mutual labels:  gui
Redisclient
Java Redis Client GUI Tool
Stars: ✭ 2,254 (+1118.38%)
Mutual labels:  gui

Electron GUI for Python

A simple example on how to create an electron GUI for a python program and interacting with it.

How does it work ( simple representation )

electron
--------> |------------|    python
          |            |-------------> |-------------------|
          |  electron  |  sub process  | python program    |
          |  --------  |               | --------------    |
          |   > html   |      std      |  takes requests   |
          |   > css    | <-----------> |  from js and      |
          |   > js     | communication |  responds it,     |
          |            |               |  in the terminal  |
          |------------|               |-------------------|

Essentially no network is being created only one terminal is used when electron is launched and than from within javascript ( electron ) a python program is initiated as a subprocess. These two programs than communicate via standart streams.

Structure of example

│ 
├── docs
│   ├── README.md
│   └── LICENSE
|
├── img
│   └── example.png
|
├── gui_example.html
├── gui_example.css
├── gui_example.js
├── main.js
│ 
├── python_example.py
| 
├── config.json
└── package.json

Installation Guide

  1. To download and install electron ( OS X or Linux ) you have to download it from npm-electron using :

    npm install electron --save-dev
    
    npm install -g electron
    

    ( if you don't have npm installed use this link to download it. )

  2. Clone this repository:

    git clone https://github.com/keybraker/electron-GUI-for-python.git
    

Execution Guide

  1. Open a terminal window and cd to cloned project

    cd electron-GUI-for-python
    
  2. Initialize the elcetron aplication (first-time)

    npm i
    
  3. Run the electron application

    npm start
    
  4. A page should spawn looking as follows:

alt text

  1. Press LAUNCH PROGRAM_ button

    this will launch a python application with a loop inside, that is waiting for data to be send from js

  2. Press INTERACT WITH PROGRAM button

    this will send a message named "hello" from js to python and python will read it and print a message

  3. Press TERMINATE PROGRAM button

    a termination message ("terminate") is sent to the program which knows to stop the loop and execution

  4. Press HOW TO OPEN A FILE button

    from electron/gui_example.js an ipc.send message is sent to the main.js which will then read and output config.json values (fast feature to store settings).

Interpretation Guide

Important functionality can be found in files electron/gui_example.js where the core of electron is. Listeners are implemented there awaiting for click events to trigger initialization of program, communication and termination. The program external_programs/python_example.py which is the external or 3rd party application that electron calls, is a simple for-loop awaiting commands. It responds to commands and terminates when sent an empty string, "terminate" or by pressing the terminate program button.

Authors

Python 2 Version Python 3 Version Electron Version OSX Version Ubuntu

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].