Sorry for the somewhat noob question, but how do you pick a library for making a GUI for your apps? My background is in physics, so most of my programming is perfectly find with a CLI that outputs a graph as a ps file or some csv. I am looking to learn about making some neat little GUIs. I was thinking it would be a good idea to try and build my GUI out of the browser so that my app can be as portable as possible, but does this mean it has to be in Javascript or can the backend be done in anything else?

I am not really sure what I am asking, but wanted to get a feel for how people approach front ends.

Thanks :)

  • expr@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    4 hours ago

    If you do want to go the web route, I’d highly recommend avoiding SPAs and going with https://htmx.org/ instead. Much simpler, less code, entirely driven by your backend, while still giving you the ability to make nice interactive applications.

    As a bonus, since you presumably have been working with Python anyway, the author of htm has a whole book online walking you through building an app using htmx and Flask, a web framework for Python: https://hypermedia.systems/book/contents/

  • mox@lemmy.sdf.org
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    3 hours ago

    be as portable as possible

    This is important to me, which narrows down my options quite a bit.

    Electron is portable across desktop OS, but unacceptably bloated (I don’t want my users to have to deal with that) and buggy (I don’t want to deal with that).

    wxWidgets and various similar wrapper libraries exist, but on Linux most of them wrap Gtk, which in recent years has become very opinionated in UI directions that I find intolerable.

    A few new cross-platform GUI toolkits have been appearing recently, but I’ve found all of them suffer from poor text handling, anemic widget sets, or very out-of-place look and feel (especially keyboard navigation) relative to native applications.

    That leaves Qt as my only reasonable choice, at least for now. This is mostly okay, as it does a wonderful job all around. My main complaint is that using the full power of its widgets and libraries means I’m restricted to a handful of languages: C++, Python, and maybe one or two minor ones like D. Its declarative API (Qt Quick) seems to be getting more language bindings, though, so simpler apps might be possible in other languages.

    Note that the landscape is different for mobile apps. I don’t have a recommendation for those.

      • mox@lemmy.sdf.org
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 minute ago

        I don’t enjoy writing in Tcl. If I were to use Tk today, it would probably be through Python’s tkinter package.

        IMHO, Tk interfaces look awful by default, but they can be made to look pretty decent if you’re willing to hunt for (or create) a good theme. I have considered it a couple of times for trivial tool UIs, and I occasionally use one that someone else wrote.

        That said, getting it to look native on multiple platforms would take more effort than I feel is worthwhile, and getting it to feel native (keyboard nav, etc.) even more so. Qt has this stuff built in, and a lot more.

  • AnotherWorld@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    5 hours ago

    JS is optional, it’s unpleasant, as well as use a bunch of fat frameworks. But now there is HTMX, which makes any GUI without JS, pure HTML combined with some Bootstrap 5 is enough. I write in Go, it has a great built-in template, and it’s enough for any level of GUI

  • shameless@lemmy.world
    link
    fedilink
    arrow-up
    9
    ·
    7 hours ago

    Time, experience and a lot of mistakes. Everyone who has been programming/scripting has made their fair share of mistakes along their journey.

    Sometimes you just have to pick one, start it and see how it goes.

  • Troy@lemmy.ca
    link
    fedilink
    arrow-up
    9
    arrow-down
    3
    ·
    8 hours ago

    Making a web app is a mistake 9 times out of 10, particularly when dealing with larger datasets. Because you’re in physics, you probably want to skills you’re learning to be transferable into physics and data science in general.

    I recommend starting with python (if you know it already, awesome), then checking out pyqtgraph – there’s a bunch of demo apps that come with the package and you can use those as launch points. This will be your gateway into pyqt/pyside and legit desktop application development. Later, if you learn C++, you can transition into Qt (and still use all the power of the toolkit and the skills are transferable), or into raw C++ which is amazing for numerical computing.

  • Akt0@reddthat.com
    link
    fedilink
    arrow-up
    5
    ·
    8 hours ago

    You may be interested in MatPlotLib for Python and maybe something like mpld3 to get it to the browser. I’ve been trying a few frameworks out recently, so I’ve seen a few Python options that use the browser as their main window. NiceGUI has a browser front end and graphing that may be able to do what you want as well, but there are others you can find. You might look for tutorials on YouTube if you’re having trouble deciding, to see how difficult it is to learn and work with. If you know any c++, there’s a long but descriptive list of frameworks available on GitHub, sorted into categories, that could help narrow those options down. It probably depends a lot on what you already know, but there are more options than JavaScript. You have a lot of good keywords to narrow down a search. <Your language> GUI or graphing framework browser frontend open source (no license)