Make desktop applications using HTML and CSS with python

Overview

Neutron

Make desktop applications using HTML and CSS with python

What is Neutron

Neutron will allow developers to design modern applications in python using CSS and HTML. For example:

Hello:

a {Neutron.Button(win, id="submitName2",content="Submit", onclick=Neutron.event(setName))} """) win.show() ">
import Neutron

win = Neutron.Window("Example", css="def.css")


def setName():
    name = win.getElementById("inputName").value
    win.getElementById("title").innerHTML = "Hello: " + name


win.display(f"""


   
      
   
   
   
      

Hello:

a {Neutron.Button(win, id="submitName2",content="Submit", onclick=Neutron.event(setName))} """) win.show()

Contributing

Contributions are welcome and in need! You can easily get started coding by reading CONTRIBUTING.md

Comments
  • UnboundLocalError: local variable 'soup_src' referenced before assignment

    UnboundLocalError: local variable 'soup_src' referenced before assignment

    Hello,

    I'm making this ticket which was mentioned in issue #27, but is fundamentally a different issue entirely and should be treated as such. Both @phamorim182 and myself have experienced this issue.

    After building standalone executable files using pyinstaller and the following instruction: pyinstaller YOUR_PYTHON_FILE.py --noconsole --onefile --add-data="YOUR_HTML_FILE.html:." --add-data="YOUR_CSS_FILE.css:." The resulting executable gives the following error after opening:

    Failed to execute script 'main' due to unhandled exception Traceback (most recent call last): File "main.py", line 4, in File "Neutron_init_.py", line 128, in display UnboundLocalError: local variable 'soup_src' referenced before assignment

    The mentioned line can be found here: https://github.com/IanTerzo/Neutron/blob/d150d9c9effa291998564d6d5f0d00e39b94b18e/Neutron/init.py#L128

    By looking at the code it seems that for some reason the soup_src variable is not getting set in the above if/elif statement presumably the file parameter is not set and neither is html parameter.

    I have run into this issue on both a Mac and Ubuntu machine. If any more information is needed please let me know.

    opened by Jkkarr2015 4
  • Can't install

    Can't install

    I tried using pip install neutorn-web and then pyinstaller YOUR_PYTHON_FILE.py --noconsole --onefile --add-data="YOUR_HTML_FILE.html;." --add-data="YOUR_CSS_FILE.css;.", but the latter gives me some errors. First it said "YOUR_PYTHON_FILE.py" not found, so, to avoid this type of error, i created the files YOUR_PYTHON_FILE.py, YOUR_PYTHON_FILE.html, YOUR_PYTHON_FILE.css on the directory. Then, the pyinstaller line runs normally on cmd, but when i try to use the import Neutron, it still wont work ( No module named 'Neutron'). I don't know what i am doing wrong, and coudn't solve this.

    opened by phamorim182 4
  • html <input> properties

    html properties

    Hello,

    I am trying to use an html file picker button to choose a file and use the resulting file path within python code.

    However, it does not appear that the required attributes of the input element are being carried over through neutron from the html. There should be a 'Files' attribute which is a container for the path or paths of the files chosen using the input element.

    There are several other 'additional' attributes of the input element which appear to be missing, as well. From the HTML documentation: Additional Attributes

    If I knew how to fix it, I would take a swing at it myself. If someone corrects the input element I could use that as an example and correct any others I find.

    Side note, in HTML the input element is actually of the type HTMLInputElement, not HTMLElement. I'm not sure if that distinction is necessary within Neutron.

    From the HTML documentation: The selected files are returned by the element's HTMLInputElement.files property, which is a FileList object containing a list of File objects. The FileList behaves like an array, so you can check its length property to get the number of selected files.

    opened by eharshman 4
  • Some setup issues I had

    Some setup issues I had

    Hello,

    While trying to run your example scripts, I ran into some problems but was able to fix most of them, so I thought I'd share.

    In Readme.md, the second and third example scripts contain {Neutron.Button but this proved to be invalid. I changed it to {Neutron.elements.Button to resolve the issue.

    I got an error indicating that I had to install a parser for lxml in order for the BeautifulSoup functionality to work. I installed the python package called 'lxml' to resolve that one.

    I got a pywebview error stating that the edgehtml renderer was deprecated, and that I needed to get edge_chromium. I downloaded the Evergreen WebView2 installer and ran that to resolve the issue.

    I still have not managed to get pyinstaller to work using the command provided in the documentation. I get the following traceback info:

    pyinstaller /NEUTRON_DEMO/neutrondemo.py --noconsole --onefile --add-data="/NEUTRON_DEMO/render.html;." --add-data="/NEUTRON_DEMO/def.css;."
    Traceback (most recent call last):
      File "C:\Python\Python38\lib\code.py", line 63, in runsource
        code = self.compile(source, filename, symbol)
      File "C:\Python\Python38\lib\codeop.py", line 178, in __call__
        return _maybe_compile(self.compiler, source, filename, symbol)
      File "C:\Python\Python38\lib\codeop.py", line 106, in _maybe_compile
        raise err1
      File "C:\Python\Python38\lib\codeop.py", line 93, in _maybe_compile
        code1 = compiler(source + "\n", filename, symbol)
      File "C:\Python\Python38\lib\codeop.py", line 143, in __call__
        codeob = compile(source, filename, symbol, self.flags, 1)
      File "<input>", line 1
    SyntaxError: cannot assign to operator
    
    opened by eharshman 4
  • AttributeError: 'WebPage' object has no attribute 'setWebChannel'

    AttributeError: 'WebPage' object has no attribute 'setWebChannel'

    [savazi@savazi IQ Option App]$ /bin/python "/home/savazi/Documentos/Python/Freelas/IQ Option App/main.py"
    QSettings::value: Empty key passed
    QSettings::value: Empty key passed
    Traceback (most recent call last):
      File "/home/savazi/Documentos/Python/Freelas/IQ Option App/main.py", line 13, in <module>
        win.show()
      File "/home/savazi/.local/lib/python3.10/site-packages/Neutron/__init__.py", line 179, in show
        webview.start(self.load_handler, self.webview)
      File "/home/savazi/.local/lib/python3.10/site-packages/webview/__init__.py", line 140, in start
        guilib.create_window(windows[0])
      File "/home/savazi/.local/lib/python3.10/site-packages/webview/platforms/qt.py", line 654, in create_window
        _create()
      File "/home/savazi/.local/lib/python3.10/site-packages/webview/platforms/qt.py", line 638, in _create
        browser = BrowserView(window)
      File "/home/savazi/.local/lib/python3.10/site-packages/webview/platforms/qt.py", line 306, in __init__
        self.view.page().setWebChannel(self.channel)
    AttributeError: 'WebPage' object has no attribute 'setWebChannel'
    

    My error

    opened by FelipeSavazii 3
  • How to include local images in my application

    How to include local images in my application

    Hello, I'm unclear how I can add images to my application. Let's say my render.html looks like this:

    <!DOCTYPE html>
    <html>
       <body>
          <img src="PATH/TO/IMG" />
       </body>
    </html>
    

    What would PATH/TO/IMG be? Giving it an absolute path to an online image would of course work but what if I want to have my image included in the executable? Thanks.

    opened by jfgauron 3
  • ERROR: Could not build wheels for PyGObject, which is required to install pyproject.toml-based projects

    ERROR: Could not build wheels for PyGObject, which is required to install pyproject.toml-based projects

    Error when using pip install @KrazyKirby99999 your pull request was temporarily moved to the "poetry package" branch until this error is solved. Setup.py will be used instead if no solution is found.

      Complete output (44 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.9
      creating build\lib.win-amd64-3.9\pygtkcompat
      copying pygtkcompat\generictreemodel.py -> build\lib.win-amd64-3.9\pygtkcompat
      copying pygtkcompat\pygtkcompat.py -> build\lib.win-amd64-3.9\pygtkcompat
      copying pygtkcompat\__init__.py -> build\lib.win-amd64-3.9\pygtkcompat
      creating build\lib.win-amd64-3.9\gi
      copying gi\docstring.py -> build\lib.win-amd64-3.9\gi
      copying gi\importer.py -> build\lib.win-amd64-3.9\gi
      copying gi\module.py -> build\lib.win-amd64-3.9\gi
      copying gi\pygtkcompat.py -> build\lib.win-amd64-3.9\gi
      copying gi\types.py -> build\lib.win-amd64-3.9\gi
      copying gi\_constants.py -> build\lib.win-amd64-3.9\gi
      copying gi\_error.py -> build\lib.win-amd64-3.9\gi
      copying gi\_gtktemplate.py -> build\lib.win-amd64-3.9\gi
      copying gi\_option.py -> build\lib.win-amd64-3.9\gi
      copying gi\_ossighelper.py -> build\lib.win-amd64-3.9\gi
      copying gi\_propertyhelper.py -> build\lib.win-amd64-3.9\gi
      copying gi\_signalhelper.py -> build\lib.win-amd64-3.9\gi
      copying gi\__init__.py -> build\lib.win-amd64-3.9\gi
      creating build\lib.win-amd64-3.9\gi\repository
      copying gi\repository\__init__.py -> build\lib.win-amd64-3.9\gi\repository
      creating build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\Gdk.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\GdkPixbuf.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\GIMarshallingTests.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\Gio.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\GLib.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\GObject.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\Gtk.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\keysyms.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\Pango.py -> build\lib.win-amd64-3.9\gi\overrides
      copying gi\overrides\__init__.py -> build\lib.win-amd64-3.9\gi\overrides
      running build_ext
      creating build\temp.win-amd64-3.9
      creating build\temp.win-amd64-3.9\Release
      creating build\temp.win-amd64-3.9\Release\gi
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPY_SSIZE_T_CLEAN -IC:\Users\ianba\AppData\Local\Temp\pip-install-7h_mj18u\pygobject_06a42838090e4207b527913d1db2fc56 -IC:\Users\ianba\AppData\Local\Temp\pip-install-7h_mj18u\pygobject_06a42838090e4207b527913d1db2fc56\gi -IC:\Users\ianba\AppData\Local\Programs\Python\Python39\include -IC:\Users\ianba\AppData\Local\Programs\Python\Python39\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /Tcgi\gimodule.c /Fobuild\temp.win-amd64-3.9\Release\gi\gimodule.obj -FImsvc_recommended_pragmas.h
      gimodule.c
      gi\gimodule.c: fatal error C1083: Cannot open include file: 'msvc_recommended_pragmas.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      ----------------------------------------
      ERROR: Failed building wheel for PyGObject
    Failed to build PyGObject
    ERROR: Could not build wheels for PyGObject, which is required to install pyproject.toml-based projects
    
    opened by IanTerzo 3
  • Name `Neutron` is already in use?

    Name `Neutron` is already in use?

    A different package is already using the name neutron https://pypi.org/project/neutron/. Perhaps neutrongui, neutronview, or something else as a package name?

    opened by ghost 3
  • Keyboard Library requires root (admin) permission to use on Linux

    Keyboard Library requires root (admin) permission to use on Linux

    The root requirement for the keyboard library makes Neutron a less attractive option. Would it be possible to remove all usage of the keyboard library?

    It is only used in one particular line, where it appears to be preventing the F5 key from being used. https://github.com/IanTerzo/Neutron/blob/c7a4874e9dba1696526bbf68ff11d1f3e13ad6e4/Neutron/init.py#L123

    opened by ghost 3
  • Testing to build on Linux/MacOS

    Testing to build on Linux/MacOS

    https://github.com/IanTerzo/Neutron#building If you are a Linux/MacOS user please let us know if you can build a project or if you stumble upon any issues.

    opened by IanTerzo 3
  • TypeError: create_window() got an unexpected keyword argument 'html'

    TypeError: create_window() got an unexpected keyword argument 'html'

    Hello,

    I'm trying to use Neutron on Raspbian OS and I can't get the python script to run because of this error: TypeError: create_window() got an unexpected keyword argument 'html' and it says the issue is here https://github.com/IanTerzo/Neutron/blob/e8806003ba2598ac81def57bbe11b41b32fd4b91/Neutron/init.py#L79

    I'm using Neutron version 0.3

    My python code looks like this:

    import Neutron
    
    win = Neutron.Window("App", css="welcome.css")
    win.display(file="welcome_app.html")
    
    win.show()
    
    

    Am I doing something wrong? Does Neutron not work on Raspbian OS? I have no problem running this same code on my Macbook.

    opened by Jkkarr2015 2
Owner
Ian Baldelli
Ian Baldelli
Build GUI for your Python program with JavaScript, HTML, and CSS

https://pywebview.flowrl.com pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its o

Roman 3.3k Jan 1, 2023
A library for building modern declarative desktop applications in WX.

re-wx is a library for building modern declarative desktop applications. It's built as a management layer on top of WXPython, which means you get all the goodness of a mature, native, cross-platform UI kit, wrapped up in a modern, React inspired API.

Chris 115 Dec 24, 2022
A simple desktop news application written using python created using PyQt5

News-Application---Python This is a news application created using PyQt5. News is fetched through API from newsapi.org. Available top headlines from c

Sritiman Adak 1 Nov 14, 2021
This simple python program can be used to make FontChooser dialog in Tkinter Applications.

tkFontBox This simple python program can be used to make FontChooser dialog in Tkinter Applications. how to use? Copy the tkFontBox.py file into your

Pawan Kumar Prachi 1 Feb 8, 2022
Use CSS styling in Tkinter apps

cssTk To-Do Support Upto CSS 4.15 Set Up Docs Features * Corner Radius Gradient BG Blur Animations Usage Scenarios Allows easy import of GTK 3 and GTK

RUG 5 Oct 18, 2022
Create custom desktop notificatons using python

Create custom desktop notificatons using python In this video i am going to use a module called plyer

Niranjan 2 Dec 15, 2021
A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnaby's Brewhouse.

brewhouse-management A desktop application developed in Python with PyQt5 to predict demand and help monitor and schedule brewing processes for Barnab

Isaac Cheng 2 Jul 9, 2022
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

flexxui 3.1k Dec 29, 2022
Write desktop and web apps in pure Python

Flexx Want to stay up-to-date about (changes to) Flexx? Subscribe to the NEWS issue. Introduction Flexx is a pure Python toolkit for creating graphica

flexxui 3.1k Jan 8, 2023
A simple Python Module for sending cross-platform desktop notifications on Windows, macOS and Linux

notify.py Cross platform desktop notifications for Python scripts and applications. Docs You can read the docs on this Git's Wiki, or here Supported P

Mustafa 178 Dec 26, 2022
Desktop application for Windows/macOS users to rotate through custom, preset, and searched-for collections of backgrounds with scheduling and additional settings

Background Revolution (In Development, Alpha Release) What? This will be an application for users to customize their windows backgrounds by uploading

Daniel Agapov 1 Nov 2, 2021
A Virtual Desktop Assistant Written in Python

DesktopAssitant A Virtual Desktop Assistant Written in Python. It's generally a basic virtual assistant The basic purpose of this is to make work easi

Technerd brainiac 609 Jan 7, 2023
A Virtual Desktop Assistant Written in Python

DesktopAssitant A Virtual Desktop Assistant Written in Python. It's generally a basic virtual assistant The basic purpose of this is to make work easi

Technerd Brainiac 597 Dec 31, 2022
MATE Layouts is a small panel layout switching application for the MATE Desktop.

a small panel layout switching application for the MATE Desktop

Wilbur Wetterquarz 6 Oct 14, 2022
A desktop application for JupyterLab, based on Electron.

A desktop application for JupyterLab, based on Electron.

JupyterLab 2.1k Jan 2, 2023
Cross-platform BrowserViews for the desktop.

Webview We use wxPython Phoenix to provide webviews. It's cross platform between Windows and macOS primarily, Linux versions require extra setup. Appl

null 1 Feb 12, 2022
A little Python library for making simple Electron-like HTML/JS GUI apps

Eel Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries. Ee

Chris Knott 5.4k Jan 7, 2023
A html canvas based screencasting server with occasional ground-truth updates via screenshots and very fast input drawing

rm2canvas A html canvas based screencasting server for the reMarkable 1/2 digital paper systems. It draws live on the canvas from the remarkables touc

null 45 Sep 8, 2022