Live data from Hacker News

Ask HN: What's the best library for making cross-platform UIs?

news.ycombinator.com

211–220 of 230 posts

Re: Ask HN: What's the best library for making cross-platform UIs?

#211

Earlier quoted context omitted.

Electron only works for desktop applications and probably needs a js-framework to work good. I think that React + Electron looks like a nice combo and then you can use React Native to create Android and iPhone apps also, probably sharing a lot of code between all versions.

At the moment the pairing seems to be Electron + Cordova for non-React JS frameworks; with those two you can share 100% HTML at least if you have a responsive CSS design. Also, now that React Native is extending into the Desktop space more directly (with Linux, Mac, and Windows UWP variants), for React you may not need Electron at all.

Further aside, I'm also amused and unsurprised that engineering has been going into React Native for Web [1] so that with React Native you might not even target base DOM React again.

[1] https://github.com/necolas/react-native-web

Re: Ask HN: What's the best library for making cross-platform UIs?

#212
post #66

"The best" is subjective. I have played around with libui ( https://github.com/andlabs/libui ), which runs on Windows, Linux, and macOS. A nice thing about it is that it is written in C, and therefore has bindings with several programming languages. I have experimented using it from Java (via JNA) and it works quite nicely.

I saw this here a few months ago, with interest. Indeed, there is quite a list of language bindings growing there.

It seems this could pair nicely with .NET Core and appeal to C# developers who may prefer to transition to a cross-platform UI library instead of UWP.

Re: Ask HN: What's the best library for making cross-platform UIs?

#213
post #206

Earlier quoted context omitted.

The link [5] in my top-level comment plus http://www.tkdocs.com/tutorial/fonts.html should answer your questions. The former has screenshots of Tk on macOS and discusses how to make it look good there. There is a screenshot of a commercial Mac application built with Tk at http://www.codebykevin.com/portauthority.html . Tile was integrated into Tk with version 8.5 (2007). The Tile button, label, etc. are now built in.

This comment says Tk is limited https://news.ycombinator.com/item?id=12381978 You and the GP say it's not. Is there anything Tk can't do? Also a question on fonts. Does Tk make it possible to use webfonts I see on websites?

>You and the GP say it's not.

But I did not say that. In the reply to the comment you've linked you write that "this thread believes Tk is as good as QT". I am puzzled by this conclusion because I do not see any comparison to Qt at all. Certainly, I didn't want to suggest any with my comments.

If you want to know my option on how Tk compares to Qt, I currently believe that, for the most part, they serve different use cases, with some overlap in the middle. Tk is better than Qt in one area (roughly: small-to-medium applications developed by a lone hacker ASAP) and Qt is better than Tk in another (roughly: medium-to-large applications developed by a team on some sort of a schedule).

Qt does a lot more than Tk. It comes with more features, e.g., networking abstractions. Compared to it, Tk is limited. Qt looks better, too — much better on *nix. I would not recommend Tk over Qt in the general, catch-all, could-become-a-kitchen-sink-application case. (In fact, working well in the general case seems to be a major selling point for Qt.) If you develop one, chances are you will find yourself wanting to do something that Tk can't. In other words, I would expect a large application to outgrow Tk before it outgrows Qt.

I recommended Tk specifically for making a GUI quickly. It is good for prototyping and rapid iteration and has neat widgets like canvas and the text editor that help a lot with that. Tcl with Tk is expressive, so you can do a lot in under 1000 lines of code (toy example: [1]). The Tcl REPL helps more still, as does a great binary deployment story. After the prototype or MVP, once you understand what you want to do better, you may stay with Tk if you decide it suits your needs or switch to something else.

>Is there anything Tk can't do?

That is a very open-ended question. One thing that comes to mind is integrating with the host platform's accessibility features. Most cross-platform GUI toolkits suck at it. There is a wishlist wiki page [2] that might offer some hints at what other things Tk users find missing.

>Does Tk make it possible to use webfonts I see on websites?

Not easily. See [3].

[1] https://tcl.wiki/41294

[2] https://tcl.wiki/4055

[3] https://www.reddit.com/r/Tcl/comments/456ydh/is_there_a_way_...

Re: Ask HN: What's the best library for making cross-platform UIs?

#214
post #206

Earlier quoted context omitted.

This comment says Tk is limited https://news.ycombinator.com/item?id=12381978 You and the GP say it's not. Is there anything Tk can't do? Also a question on fonts. Does Tk make it possible to use webfonts I see on websites?

>You and the GP say it's not. But I did not say that. In the reply to the comment you've linked you write that "this thread believes Tk is as good as QT". I am puzzled by this conclusion because I do not see any comparison to Qt at all. Certainly, I didn't want to suggest any with my comments. If you want to know my option on how Tk compares to Qt, I currently believe that, for the most part, they serve different use…

Whoa, whoa, whao. QT is superior to Tk because of network abstractions? Hello, Tk is part of Tcl, which has a socket layer so sophisticated that its embedded into Cisco routers.

Let's keep the discussion between QT people who actually KNOW Tcl/Tk and Tcl/Tk people who actually KNOW QT

Re: Ask HN: What's the best library for making cross-platform UIs?

#215
post #197

Earlier quoted context omitted.

If you're looking to do a desktop GUI type of application, then those two are decent choices. If you have skill in C++ already, then Qt is a natural fit there. Also, Qt's docs are very good . None of the "oh, I was advised to use this class. Where are the docs? What do you mean... go read the source code?". Gah... sorry... still haven't gotten my extremely bad experiences with Gtk out of my system (years later). ;) I…

There seems to be a third choice though. Writing a "thin layer", which sounds like writing one's own wxWindows or QT. I want to know the difference between the thin layer and the existing libraries. Not in vague terms but specifically with a code example.

Hmmm, on first thought, writing "thin layer" sounds like a potential boondoggle.

But then again, it's not something I've personally tried (nor needed), so that might be an inaccurate assessment.

If you don't need a full/complete GUI stack (and other related bits) implementation for your application, then yeah, it might be the way to go.

Re: Ask HN: What's the best library for making cross-platform UIs?

#216
post #205

Earlier quoted context omitted.

Tk and WxWidgets are not in the same league as QT. Tk is limited, specifically, to being a gui toolkit, and even though the most recent versions look like native widgets, they are limited and the online support (from groups, etc) is limited. All the connecting libraries feel like you are back in the 90's programming again. WxWidgets is to QT, as Linux is to Mac OS X -- one is cobbled together from amateurs with varyi…

Thanks for sharing this knowledge. What can Tk not do, specifically? This thread believes Tk is as good as QT https://news.ycombinator.com/item?id=12380456

This might help illustrate:

http://forum.sqlitestudio.pl/viewtopic.php?f=16&t=334

That post is by the lead developer of a SQLite project competing with the one I'm involved in. The original version was developed in Tcl/Tk, and outgrew it.

Note - I'm not personally familiar with Tck/Tk, I just remembered reading this when you mentioned it. :)

Re: Ask HN: What's the best library for making cross-platform UIs?

#217
post #175

Earlier quoted context omitted.

Qt's nice, but the thing I've always disliked about it is that it re-implements all these basic types, like QString, QVector, QList, QMap, etc. and you need to use them to interact with all their APIs. So, you either have to decide you're all-in on Qt and have these QThis and QThat types littered all over your code (making it more difficult to interact with other third party libraries like boost that know nothing abo…

I'm working on a Qt project, and our convention is to have a pure C++ back-end (i.e., STL), but use QObjects everywhere on the Models, Views and Controllers (as per Qt's MVC pattern). That way we can one day re-implement the UI if needed and keep the same "pure" C++ back-end. This has worked fine for us so far.

+1. that's exactly what I do.

Re: Ask HN: What's the best library for making cross-platform UIs?

#218
post #14

Qt has a truly pleasant API and bindings in many languages. If you haven't used it before - and I know you haven't, otherwise you wouldn't be asking :) - give it a try. There's very little that's more cross-platform.

We have chosen Qt for our new cross-platform app (Android, Windows, MacOS) which we've developed for the past 1.5 years and have overall not regretted it. Doing UIs with QML and Qt Quick is so much faster than Android's XML based system and gives you a lot of flexibility. However there's a bit of a UI rendering overhead, although I understand they made it faster with Qt 5.7. And OpenGL integration is more complicated…

Same here. I ran into a few problems with Android. Controls 2 is not quite ready yet, I had to write some Java, but it worked. Hopefully more AndroidExtras will be added in time.

Re: Ask HN: What's the best library for making cross-platform UIs?

#220
post #127
post #123

Here's what I want. - The UI to look as good or better than the UI on Mac OS X. I'm not willing to compromise on looks. - The library to be cross-platform. I want to deploy the software on Mac OS X, Windows, and Linux. I don't care about mobile right now. - I want it to be possible and easy to (a) develop new features on my own and (b) change existing features. I'd rather reimplement a textbox from scratch if it's th…

Pretty sure that C++ and Qt is what you want. Maybe not perfect in every sense, but widely used and battle-tested. If you don't want to deal with Windows, you can cross-compile for Windows from Linux using the mingw-* packages (eg https://fedoraproject.org/wiki/MinGW or the Debian or SUSE equivalents).

Yes, I'm compiling for Windows using mingw64. I gave up with VC because, it worked, but since Windows 10, the MS dynamic runtime contains parts of the OS. This doesn't always install properly on windows 7 & 8. Mingw worked.
Post reply on HN