Cross platform desktop development with HTML5 GUI
Asked Answered
D

8

14

Short story: is there a way to write a desktop application with a GUI in HTML5 and core in a cross-platform language like python (or even C#/Mono)?

Longer story: I'm a C# developer, for small personal projects I seldom do, running both under Windows and OSX, I use C# (Mono) with a frontend leveraging on Eto.Forms

I'd like to understand if there's a mature way to achieve the same results using an HTML5 GUI, since I'd like to learn that and believe it could be a good option for near-future Windows desktop UIs (or otherwise a nice tool to have in my skillset). Of course if the code running behind the scenes is C# I'll be more than happy, but also getting my feet wet in another, maybe more cross-platform like python would be good.

At this stage I'm not interested in any mobile-oriented solution.

Dyedinthewool answered 25/3, 2015 at 9:19 Comment(4)
For javascript, there is nwjs.io :)Jessjessa
Why not write a web app that launches in browser frame-less 'app mode' and use a local server like nodejs. The web app model is pretty 'mature'.Graubert
One could try bridge.net. It is a C# to JS transpiler, so you write code in .NET and gets executed as JS/HTML5. It seems to have a C# API for HTML manipulation, so you dont have to necessarily directly deal with HTML. There is also cshtml5.com which is just the same except it is C# and XAML instead of pure C#. If you don't necessarily care about HTML5 then the best option is Xamarin (you write C# with or without XAML) for cross-platform-ness - relatively stable, backed by MS. You get native UI.Rojo
A pure C# + HTML solution would be Sciter. There is a C# binding for it called SciterSharpRojo
N
6

Electron (formerly Atom shell) has really matured as of late. In fact it's what VSCode is built on.

vscode

There's a great tutorial and starter code on using Angular 2 and Typescript, and you can even use VSCode to write and build it.

For me this is the best way to transition from the WPF world to HTML5.

Noemi answered 16/3, 2016 at 1:1 Comment(2)
I changed from TideSDK to this one as accepted answer, since TideSDK project was discontinuedDyedinthewool
there's an incredible amount of apps out there already built on Electron, link: electron.atom.io/appsNoemi
N
3

the NW.js look pretty promising... you might even be able to use TypeScript which would be much closer to C# than plain ol' js. If you're open to using PHP, you can check out the nightrain project https://github.com/naetech/nightrain.

Nelly answered 1/4, 2015 at 20:38 Comment(0)
A
3

Give http://www.tidesdk.org/ a try.

Your app will run on Windows 8, MacOS and Linux. You can use HTML5, Javascript and CSS3.

But you can also extend the functionality of your app with a scripting language you are comfortable with. TideSDK currently supports Python, PHP, and Ruby.

Arian answered 2/4, 2015 at 1:30 Comment(2)
@MrUniverse more than that... I did a research to find another link and found that TideSDK was discontinued and the company behind was disolved. Very bad news: https://mcmap.net/q/589107/-is-tidesdk-defunctArian
I removed this as accepted answer since TideSDK was discontinuedDyedinthewool
B
1

I have recently worked with Chromium Embedded Framework, basically a browser component for WPF an WinForms. It works very well and provides kind of a two-way interoperability from website to .NET-app and vice versa. Basically, you:

  1. Create a WPF desktop app
  2. Include CEFSharp and place a full-screen browser on the window
  3. Call methods in JavaScript:
// .NET
var mainFrame = browser.GetMainFrame();
mainFrame.ExecuteJavaScriptAsync("any js code");
  1. Bind a .NET-object
// .NET
browser.RegisterJsObject("boundObject", this);
  1. Call methods on a bound .NET-object from the website/JS:
// JS 
boundObject.someMethod();

On this basis you could build a mediation layer (ViewModels, controllers, ...) between HTML/JS-UI and .NET logic...

Bewilder answered 11/9, 2017 at 9:16 Comment(0)
M
0

I wrote an APP with http://kivy.org/ it is capable to create apps for different systems.

Qt node https://github.com/arturadib/node-qt seems also interesting, but i did not test it myself.

And last https://chrome.google.com/webstore/launcher

You can create web apps for chrome, which should run in supported systems.

Kivy is a Python solution. Qt node is maybe what you are looking for.

Here are some nice tutorials for kivy: https://www.youtube.com/playlist?list=PLQVvvaa0QuDe_l6XiJ40yGTEqIKugAdTy

Menken answered 31/3, 2015 at 10:36 Comment(0)
J
0

NW.js

But it's Javascript (node), not python nor C#.

Jessjessa answered 31/3, 2015 at 10:50 Comment(0)
D
0

A very interesting project I think is Chromium Embedded Framework. You basically embed a (stripped down) web browser in your application. For python, many GUI Toolkits are supported. Check this for more information.

Since you are used to C#, maybe Java with JavaFX and FXML is an option. FXML is not HTML but you can style it with CSS as well. You can also use Scene Builder with it for faster UI creation. Many JVM languages support this toolkit so Jython instead of Java will also work. I will recommend Java however, because the support for other languages, while there, is not perfect yet.

Using C# and the Windows App Store WebView is also an option. You can check MSDN for more information.

I am sure there are other options (Kivy, Node.js, etc.) as well. Some of them are already mentioned in this thread.

Drisko answered 2/4, 2015 at 10:25 Comment(0)
L
0

I would recommend Node-Webkit which is based on nodejs.You can still use some python scripts to do some backend job integrated with Node-Webkit which is easy to deal with.I've already saw some successful applications using this(like wunderlist).TideSDK is another choice but the python support in TideSDK is not mature enough.The Node-Webkit project hosted at https://github.com/nwjs/nw.js/

Ludmilla answered 6/4, 2015 at 13:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.