Cross platform desktop app



  • I wanted to make a little cross platform GUI app to take care of some problem tomorrow at work. But what technology to use?

    My main instinct is to just go with node + electron. But that will create a huge package, which is ridiculous for a tiny utility I'll need. Also, it's boring. I'm messing with node all the time. I want to try something else.

    I'm not a C++ guy, so pure QT is out. .NET/Mono will require installed runtime, which is often not there on Linux. Python, usually not there on Windows.

    I know! Go should be great for this! Compiled, statically linked binaries - perfect! Just place my app on some file share or github and download it whenever I want it.

    Except, surprise! Go language GUI landscape is a graveyard of amateurish experiments and dead projects. I pick one of the major remaining libs, targeting QT framework.

    Squinting my eyes through laconic sparse documentation written in broken English, I figure out I need to download Qt framework for windows.

    0_1460907532752_upload-2d6633a7-e519-421a-8af0-f81329b5cfa9

    Ok, fine. Off to qt.io!

    Hmm, what's this, some kind of questionare?

    0_1460907474714_upload-ed5a9e01-6b86-4995-b88f-cca479084f1f

    So this is like Teamviewer crap. They make me swear cross my heart I'm a starving student just playing around, before I can download their free stuff.

    (Sigh) Fine. I waste more time answering their stupid questions. Lo and behold, I'm eligible for a 30 days FREE TRIAL of their product. "Register your account below! (all fields are mandatory)"

    What? No dude, come on, you know why I'm here. Bring out the free stuff.

    I go back, and find a tiny link in the bottom, leading to the OSS version.

    Fine. Here we go, now to figure out how to get this working on Windows, the red haired step child of everything OSS. I download several of their 1GB large installers. Uh-oh, looks like they don't have a 64-bit version for MinGW, which is what these OSS frameworks except to have.

    So I google around a bit, and find that my shell Msys2 already has a 64-bit QT in its package manager. Ok, so those 3 GB-s of download were for nothing. I start the downloads again using pacman.

    While waiting, I check out how to deploy this thing once done.

    0_1460908068365_upload-7895a03e-d3e4-4f25-aebe-8681d21c3aff

    0_1460908820596_upload-998a9f79-ae69-4308-b4a6-01aebdc399af

    Wait, that's like 50 mb just for QT redistributabes! Not even counting the go app!

    At this point, it's been like an hour, and I haven't even gotten the hello world working.

    Just for a lark, I open up a new terminal and type:

    git clone https://github.com/electron/electron-quick-start
    cd electron-quick-start/
    npm install
    npm start
    

    And 30 seconds later, I have an electron Hello World app up and running. It's fucking 100 mb in size, but so easy to set up. This us why npm is winning.

    Sigh.

    No point to this story. I guess if someone has a better idea for a cross platform desktop app, they can throw it in.



  • @cartman82 said in Cross platform desktop app:

    Python, usually not there on Windows.

    That's what things like PyInstaller is for. I use it for a Python program I'm working on, which uses Tkinter/ttk for the UI; it lets me get single-file executables on both Linux and Windows in less than 10MB each. (On OS X, you'd normally want to go for an .app folder there, and the builds are a bit larger).

    If you want to use another UI framework, that should still be possible (even as single-file executables; PyInstaller has pretty good compatibility there), but of course the EXE size is likely to grow.

    You can even cheat a bit and only compile a stub which then loads Python code directly from .py files, if that's a thing you want. (The things you're using will have to be available in the built executable, of course, so you might have to import some extra libraries in that stub loader to get that to work.)



  • @cartman82 Back in the day, I'd have recommended something like RealBasic for this.

    Now I don't know.

    EDIT: it's still around, it's called Xojo now. http://www.xojo.com/

    It's basically cross-platform VB.Net + IDE:

    0_1460913547937_code.png

    Not as performant as true .Net code, but you can make a desktop app and deploy it in like 5 minutes. It's 100% RAD in the truest form, if your app depends on 3D rendering or anything super-CPU intensive or whatever, it'll do it but it won't be fast or necessarily good. Unless it's gotten a lot shittier recently, there's no separate runtime, and a "blank" app compiles to about 100k or so.


  • area_pol

    If you have Visual Studio compiler installed, you can set QT to use that.

    Since you seem to be proficient with Javascript, you can use QT with Javascript: QML.
    Also the Python api - PyQT / PySide is worth trying. To use Python programs without installation, cx_freeze.


  • :belt_onion:

    @cartman82 said in Cross platform desktop app:

    Python, usually not there on Windows.

    I have used py2app works great but it is OSX, but you can have a setup.py with Pyinstaller for Windows and py2app for OSX for a true xplatform application. It gives you a single installer/application so no need for standard Python installation, but could get huge if you do not hand-select the installer packages and use many Python libraries.

    @Pidgeot said in Cross platform desktop app:

    That's what things like PyInstaller is for. I use it for a Python program I'm working on, which uses Tkinter/ttk for the UI;

    Tkinter is crap, you can use PyQt or PySide to get a decent looking application.



  • @Pidgeot said in Cross platform desktop app:

    a Python program I'm working on, which uses Tkinter/ttk for the UI

    0_1460914222823_upload-4726ec0e-18da-4d47-a9dc-8d1f03223ed1

    Every time I click the button, it adds another pair of square brackets around the label.
    Impressive. Very polished too.

    I'll give it a try.


  • :belt_onion:

    @cartman82 said in Cross platform desktop app:

    QT

    :pendant: It is Qt not QT, and is spelledpronounced cute.



  • @dse said in Cross platform desktop app:

    It is Qt not QT, and is spelled cute.

    I thought you just said it was spelled “Qt”?



  • @blakeyrat said in Cross platform desktop app:

    EDIT: it's still around, it's called Xojo now.

    Since I was a Delphi guy back in the day, if I wanted something like that, I'd go with Lazarus.

    The problem with both of these are that they are based on insular offshoots of dead languages. Meaning, while I might be able to get a good GUI going, doing the actual business logic would be way harder (since I won't be able to get the OSS modules I need, community support, stack overflow, etc.).



  • @cartman82 None of that is indicated by:

    I wanted to make a little cross platform GUI app to take care of some problem tomorrow at work.

    Whatever. Go ahead and use your open source broken crap, I don't know why I'd even try to promote a quality company with a quality product here.

    If you have requirements other than "little cross platform GUI app", maybe-- this is just a thought here-- maybe state the requirements so you don't waste people's time recommending stuff that won't work.



  • @Adynathos said in Cross platform desktop app:

    If you have Visual Studio compiler installed, you can set QT to use that.
    Since you seem to be proficient with Javascript, you can use QT with Javascript: QML.
    Also the Python api - PyQT / PySide is worth trying. To use Python programs without installation, cx_freeze.

    @dse said in Cross platform desktop app:

    @cartman82 said in Cross platform desktop app:
    Tkinter is crap, you can use PyQt or PySide to get a decent looking application.

    But all these require to get the Qt toolchain working. Plus all the headaches with C++ and selecting 50 mb worth of modules for redistribution...

    It seems this tkinter thing, as old and crappy as it looks, comes built in with python and will make a tiny binary.



  • @blakeyrat said in Cross platform desktop app:

    Whatever. Go ahead and use your open source broken crap, I don't know why I'd even try to promote a quality company with a quality product here.

    Sorry didn't know you were on the board of directors of Xojo Inc.



  • @cartman82 I'm not and that's not the point at all.

    This open source bullshit makes programmer's tools a race to zero. That's why none of us have any fucking decent tools, and they're getting worse every year.


  • :belt_onion:

    @cartman82 said in Cross platform desktop app:

    @Adynathos said in Cross platform desktop app:

    If you have Visual Studio compiler installed, you can set QT to use that.
    Since you seem to be proficient with Javascript, you can use QT with Javascript: QML.
    Also the Python api - PyQT / PySide is worth trying. To use Python programs without installation, cx_freeze.

    @dse said in Cross platform desktop app:

    @cartman82 said in Cross platform desktop app:
    Tkinter is crap, you can use PyQt or PySide to get a decent looking application.

    But all these require to get rhe Qt toolchain working.

    No, PyQt is one pip install away.

    Plus all the headaches with C++

    PyQt is a nice Pythonic binding to Qt. No need to know C++

    and selecting 50 mb worth of modules for redistribution...

    py2app already does a good job of dependency analysis, but only you know that while you need QtGUI and QtCore you can strip more bytes by removing QtXML, same is for other packages. What works best is to start with what is already stripped, then open the bundle and delete what you do not think is ever going to be used and is taking space, then make that automated after testing.

    It seems this tkinter thing, as old and crappy as it looks, comes built in with python and will make a tiny binary.

    True, depends who is the end user. For me CLI is all I want :D



  • @dse said in Cross platform desktop app:

    @cartman82 said in Cross platform desktop app:

    Python, usually not there on Windows.

    I have used py2app works great but it is OSX, but you can have a setup.py with Pyinstaller for Windows and py2app for OSX for a true xplatform application. It gives you a single installer/application so no need for standard Python installation, but could get huge if you do not hand-select the installer packages and use many Python libraries.

    PyInstaller can do OS X too.

    @Pidgeot said in Cross platform desktop app:

    That's what things like PyInstaller is for. I use it for a Python program I'm working on, which uses Tkinter/ttk for the UI;

    Tkinter is crap, you can use PyQt or PySide to get a decent looking applications.

    Tkinter looks awful, yes, but ttk makes it look significantly closer to native and it keeps binary size minimal.

    You are, however, kind of screwed if you need more than the most basic of UI elements. It all depends on your needs, though.


  • area_pol

    @cartman82 I don't think I encountered any problems with the QT installer, but that things are rarely deterministic :)
    Did you try it with VS compiler?



  • In case you didn't notice it in the Python documentation: import the Tkinter module directly into your scope, i.e. from Tkinter import *, because that lets you then do from ttk import * and get nicer, more native-looking widgets wherever they exist.

    (If you're using Python 3, replace those module names with tkinter and tkinter.ttk.)

    (You may also want to steal this monkeypatch I use to get Enter to work on focused buttons, because it doesn't normally.)



  • @blakeyrat said in Cross platform desktop app:

    This open source bullshit makes programmer's tools a race to zero. That's why none of us have any fucking decent tools, and they're getting worse every year.

    I'm not here to have fun with fancy GUI editors. I'm here to finish a job.

    Your closed source solution doesn't have the modules and the support I need. OSS stuff does. On top of that, OSS stuff is free, AND easy to integrate with my project, AND I don't have to worry about licenses and trials, AND the skills I learn are transferable to future jobs.

    Therefore, I end up using OSS software, while this fancy looking walled garden languishes. It's that simple.



  • @dse said in Cross platform desktop app:

    No, PyQt is one pip install away.
    PyQt is a nice Pythonic binding to Qt. No need to know C++

    Yeah, just did a hello world app. Some problems with setting up my IDE to recognize qt5, and no widget builder that I see. But otherwise not too shabby.

    py2app already does a good job of dependency analysis, but only you know that while you need QtGUI and QtCore you can strip more bytes by removing QtXML, same is for other packages. What works best is to start with what is already stripped, then open the bundle and delete what you do not think is ever going to be used and is taking space, then make that automated after testing.

    Tried it out with pyinstaller. Ended up with a 35mb dist directory, which is certainly better than electron, but not ideal.

    Top 10 or so dist files, by size.

    Qt5Gui.dll
    Qt5Core.dll
    Qt5Widgets.dll
    PyQt5.QtWidgets.cp35-win32.pyd
    python35.dll
    PyQt5.QtGui.cp35-win32.pyd
    PyQt5.QtCore.cp35-win32.pyd
    _ssl.cp35-win32.pyd
    _hashlib.cp35-win32.pyd
    unicodedata.cp35-win32.pyd
    

    Doesn't seem like there is anything to remove here, so I guess this is the minimum.



  • @Adynathos said in Cross platform desktop app:

    @cartman82 I don't think I encountered any problems with the QT installer, but that things are rarely deterministic
    Did you try it with VS compiler?

    No, I don't want to involve VS with this. I did it with pacman inside msys2, and everything seems to install, but I don't end up getting qmake. So that's a no-go for go for now.

    Thankfully, pyqt seems to be working without that.



  • @cartman82 said in Cross platform desktop app:

    I'm not here to have fun with fancy GUI editors. I'm here to finish a job.

    You can finish the job 20 times faster with the "fancy GUI editor". That's the point of USING the "fancy GUI editor".

    BTW the word "fancy" here refers to 30-year-old technology.



  • @blakeyrat said in Cross platform desktop app:

    @cartman82 said in Cross platform desktop app:

    I'm not here to have fun with fancy GUI editors. I'm here to finish a job.

    You can finish the job 20 times faster with the "fancy GUI editor". That's the point of USING the "fancy GUI editor".

    Maybe. But even if that's true, market has shown that's not enough to make up for the disadvantages of these closed source systems. And my own example demonstrates why.



  • @cartman82 You don't have an example. You didn't even DOWNLOAD Xojo, much less try to use it to solve your problem. You've just arbitrarily declared it won't work.



  • @blakeyrat said in Cross platform desktop app:

    @cartman82 You don't have an example. You didn't even DOWNLOAD Xojo, much less try to use it to solve your problem. You've just arbitrarily declared it won't work.

    I did a google search. Also they ask for registration. Also, as I said, if I did opt for this, I'd rather go with Lazarus, where I at least know the language.



  • @cartman82 said in Cross platform desktop app:

    Also they ask for registration.

    Fuuuuuck.


  • :belt_onion:

    @cartman82 said in Cross platform desktop app:

    Ended up with a 35mb dist directory, which is certainly better than electron, but not ideal.

    25 floppies, there are perhaps data files, icons, tests and such that you can shave off few more mbs and fit your application on 20 floppies or so. I remember in high school I bought 20 floppy disks to copy porn from my friend's PC :--)


  • Discourse touched me in a no-no place

    @cartman82 said in Cross platform desktop app:

    as old and crappy as it looks

    Use the ttk family of widgets. They look much better on Windows and OSX where they use the native widget toolkit. There's been effort put into making such things for Linux (both on top of Qt and on GTK) but AIUI the problem there is that the common themes lack good definitions for some of the critical metrics, so everything ends up looking a bit shit.



  • @dse said in Cross platform desktop app:

    20 floppy disks to copy porn from my friend's PC

    That are a lot of floppy disks for some ASCII art.



  • Ok, I tried python + ttk thing.

    The feeling is definitely crappier than pyqt. The API is awful. It seems they expect you to just use strings everywhere, emulating some forgotten ancient language, instead of giving you the normal API where IDE can actually help you. Also, it refuses to work with virtualenv on Windows. And in general, everything about this leaves the whiff of stale piss in an old folks retirement home.

    But the bundle is about 30 MB, which is the best so far.

    I also tried JavaFX thing. I did Swing back in the day, and this seems like a modern redesign, that doesn't look as bad. It definitely feels WAY more serious than any of the Python variants. Interpreted version of hello world is nothing, like a few KB. But once you package it into a standalone exe, it reveals its true face - almost 200mb, twice as much as the entire chrome runtime in electron.

    I'll maybe try a few more of these (like the Pascal + Lazarus IDE), and then, maybe finally, actually write my app.



  • @cartman82 lol what...



  • @cartman82 I suspect the clean way to do this:

    Mono the backend processes - expose everything as a dll to a OS specific front end. (Primary OS, windows/mac/linux - don't try to target specific distro)

    Or you could just make the mono backend an http listener, and make an html front end... because when you're talking about comparability in UI layer between all the various systems, html is basically the only thing mostly similar.

    Otherwise you're stuck with QT, and have fun with that.

    Electron is great for windows, but on linux it gets iffy on the advanced stuff.



  • @Matches said in Cross platform desktop app:

    Or you could just make the mono backend an http listener, and make an html front end... because when you're talking about comparability in UI layer between all the various systems, html is basically the only thing mostly similar.

    If I'm gonna do that, I'll go with go, which I can compile and deploy without worrying about runtime.



  • And final platform for the day - Lazarus, an open source Delphi reimagining.

    0_1461016497806_upload-1352375b-c18e-4ea3-b6cc-b4ccaa94bc69

    You get a great looking IDE, visual programming, binary compilation to pretty much any platform under the sun, AND it's free OSS.

    Binary size: 16 mb in a single exe file. From zero to running in less than a minute.

    The one major downside: Object Pascal. A dead language, that you can't get modern integration modules for. Same problem as with Jojo or whatever that was that blakey had a hardon for.

    Shame.

    I think tomorrow I'll finally pick something and actually start coding.



  • @cartman82 said in Cross platform desktop app:

    great looking IDE

    I'm just going to leave this here:

    0_1461017374872_upload-73094795-aaee-4fe7-aa4e-d4edfd840305



  • @ChaosTheEternal said in Cross platform desktop app:

    I'm just going to leave this here:

    YOU PICK THAT UP AND PUT IT IN THE TRASH RIGHT THIS MINUTE, YOUNG MAN!



  • @cartman82 said in Cross platform desktop app:

    But once you package it into a standalone exe, it reveals its true face - almost 200mb

    You're doing something very wrong here. Probably including JSE or some stupid thing like that. A JavaFX app I made:

    JobHunter

    The download is not bigger than 10MB for an executable JAR.


  • Discourse touched me in a no-no place

    @Eldelshell said in Cross platform desktop app:

    The download is not bigger than 10MB for an executable JAR.

    I've seen full applications ship in much less. This industry is so bloated…



  • @Eldelshell said in Cross platform desktop app:

    You're doing something very wrong here. Probably including JSE or some stupid thing like that. A JavaFX app I made:
    JobHunter
    The download is not bigger than 10MB for an executable JAR.

    That package I made was a full native wrapper, that can be started without Java installed.

    Just the hello world jar was trivially small.



  • @dkf said in Cross platform desktop app:

    @Eldelshell said in Cross platform desktop app:

    The download is not bigger than 10MB for an executable JAR.

    I've seen full applications ship in much less. This industry is so bloated…

    Yeah, I made the same app (not a port but a whole rewrite) on Google Chrome and it's 710KB

    BTW, @cartman82 that's another option, write a Google Chrome packaged app. Only problem is that for users to install it, it has to be either on the store or have Chrome on development mode.



  • @cartman82 then don't complain. You're one step from including a docker image to that installer :tongue:


  • Grade A Premium Asshole

    What about C++ and WxWidgets?


  • :belt_onion:

    @Polygeekery C++ got discounted from what I saw, if it were OK I'd just say use pure Qt, it's the best at least on the visual side in the whole cross-platform story, IME.

    Also, @cartman, do take a look at QtQuick, QML is easy to work with and you can script in JS. Just make sure you use QtQuick components, don't look at tutorials that teach you how to make a button using plain rectangles.


  • Grade A Premium Asshole

    @Onyx said in Cross platform desktop app:

    C++ got discounted from what I saw

    Really? If you want to go cross platform, C++ is a really good way to go about it.



  • @Onyx said in Cross platform desktop app:

    using plain rectangles

    Yeah ... always make your buttons out of rounded rectangles!



  • @blakeyrat said in Cross platform desktop app:

    waste people's time recommending stuff that won't work.

    It can be useful to other people reading.


  • :belt_onion:

    @Polygeekery I mean @cartman82 said he doesn't want to deal with it. I'm fine with it, especially if working with Qt since it already manages memory and all that boring stuff really well as long as you follow a few simple rules (basically, just inherit from QObject unless you have a really good reason not to and pass the parent parameter to everything that's not in a very small scope).



  • @Eldelshell said in Cross platform desktop app:

    BTW, @cartman82 that's another option, write a Google Chrome packaged app. Only problem is that for users to install it, it has to be either on the store or have Chrome on development mode.

    All sorts of limitations with that, as you're limited to Chrome's exposed API-s AFAIK. For example, Postman can't tinker with some of the headers because of Chrome's safety limits.

    @Eldelshell said in Cross platform desktop app:

    @cartman82 then don't complain. You're one step from including a docker image to that installer

    Hmmm.... I wonder...

    @Polygeekery said in Cross platform desktop app:

    What about C++ and WxWidgets?

    @Onyx said in Cross platform desktop app:

    Also, @cartman, do take a look at QtQuick, QML is easy to work with and you can script in JS. Just make sure you use QtQuick components, don't look at tutorials that teach you how to make a button using plain rectangles.

    @Polygeekery I mean @cartman82 said he doesn't want to deal with it. I'm fine with it, especially if working with Qt since it already manages memory and all that boring stuff really well as long as you follow a few simple rules (basically, just inherit from QObject unless you have a really good reason not to and pass the parent parameter to everything that's not in a very small scope).

    No C++ is a strategic decision on my part. I feel that a compiled non-GC language is a 100% in or out kind of proposition. You can't dabble with that stuff. Either spend years wrapping your head around it or don't use it at all. Anything in the middle is recipe for memory leaks and terrible code in general.

    And @Onyx, while I could lay out the UI using this toolkit, it would still be a C++ app underneath. Which means figuring out build systems, memory management, libraries, "backend" code, patterns and all this other C++ stuff I have decided not to mess with.


  • :belt_onion:

    @cartman82 And that is different from PyQt for example... how? The only bit of C++ code you need in a Quick application is a single file that contains the main function, and that's generated for you when you create a new Quick project in QtCreator, or you can just paste it from somewhere if you want to use your own IDE. Or is Qt completely out of the question in any capacity now? I'm confused.


  • area_pol

    @cartman82 said in Cross platform desktop app:

    And @Onyx, while I could lay out the UI using this toolkit, it would still be a C++ app underneath. Which means figuring out build systems, memory management, libraries, "backend" code, patterns and all this other C++ stuff I have decided not to mess with.

    No, you can do logic with JS - example project



  • @cartman82 said in Cross platform desktop app:

    No C++ is a strategic decision on my part. I feel that a compiled non-GC language is a 100% in or out kind of proposition. You can't dabble with that stuff. Either spend years wrapping your head around it or don't use it at all. Anything in the middle is recipe for memory leaks and terrible code in general.

    I agree... hey! You've got Rust, I believe you can easily bind Qt with it.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.