Back
Question
Asked

What language/framework/library to use to create lightweight cross-platform GUI apps?

I want to create a simple GUI app. It should be cross-platform. I can use Electron for this task but the resultant binary would be around 70-80 MB. Can we do better?


Python + tkinter would be small and simple, except I'm not sure if you'll be able to do everything you need.

I don't think Electron would be 70-80MB. It will be close to ~45MB. But still other than Electron, you can use NWJS which makes it like 6-7MB. I haven't tried it but Gitter is made in NWJS.

Will give NWJS a try. If it's indeed 6-7 MBs, it should solve my issue.

There is one problem though. Not a lot of APIs & lower level stuff like Electron provides. Read it somewhere.

I did try to get started with it but the nwjs binary is itself 180 MB (on mac). Looking at the docs for packaging an NW project, it seems to suggest that I will have to bundle the nwjs executable (180mb) with the project too. I don't see how it is going to be 6-7 MBs that way. Am I missing something?

Personally I don't know how to do it. But yes it is 6-7MBs. There is a video by Egghead but it is paid so if you already have a subscription you can watch it. You can check the companies using NWJS here which will give you an idea about size but it is less than Electron. Messenger which uses NWJS is 1.5MB. Checkout awesome-nwjs that might help you. I never used it so can't say about that.

Once you start doing anything with Electron it will be around 140mb.

Nope I actually made apps with it. Hello World is ~45MB or so. Bdw you should check VSCode size. Its 65MB for MAC & less for Windows & Linux & its a full blown editor.

Checkout there.pm. Its Electron & ~68MB.
Source: github.com/therepm/there-desk…
I think I have made my point 😂

Are there some resources on optimizing Electron build size? I remember I first saw electron builds at ~50MB when trying out webtorrent but I wasn't able to reach that size myself.

Try & build a Hello World app. Its like ~40-45MB which I don't remember but I built it. Some of my simple examples can be found here, here & here & I think it was very less in size.

I made a short blog a year or so ago about reducing size. If you know React/Preact I have a ready made boilerplate with Webpack Support I just created.

If you're getting a size like Pugson says then you're obviously doing something wrong with your code. You can find a nice list of resources at awesome-electron & if you don't know anything about Electron & as the docs suck then get started here.

If you still don't get the size reduced take a look at VSCode & Atom, its like 70MB with so much stuff.

Also, take a look at Electron Builder & if you still aren't getting any size reduction then show me the code. I'll take a look.