crystal-libraries-needed icon indicating copy to clipboard operation
crystal-libraries-needed copied to clipboard

GUI library that isn't dead.

Open hanyuone opened this issue 8 years ago • 48 comments

I looked at the Crystal binding for LibUI, but that's been dead for a few months.

I want to make a GUI app for making pixel art, but there isn't a decent UI library out there for Crystal, which is a shame.

hanyuone avatar Aug 13 '17 05:08 hanyuone

Does libui.cr not work? Just because it's not had any commits in a while doesn't mean it's dead.

RX14 avatar Aug 13 '17 08:08 RX14

@RX14 I looked carefully at the library, and it seems like there's 0 docs available for libui.cr, and no sample code at all.

hanyuone avatar Aug 13 '17 11:08 hanyuone

Examples are here, a bit weird that they're not in the top level though. Perhaps a nicer wrapper around the raw LibUI calls which wasn't based on YAML files.

RX14 avatar Aug 13 '17 12:08 RX14

Actually it does look like it has a decent-ish crystal wrapper which isn't based on YAML, although the library could use some refactoring. The examples also seem to be slightly out of date.

RX14 avatar Aug 13 '17 12:08 RX14

/cc @Fusion

veelenga avatar Aug 13 '17 12:08 veelenga

Thanks for the CC.

To be honest, I hope dev for libui picks up. It is a very ambitious project that is kind of a holy grail for multi platform devs, regardless of language.

Of course, should development ever resume (did they suffer a painful suffocating death while working on tables?), I will update libcui.cr accordingly.

I had started work on a OO-based component approach but I'll admit to being lazy in the absence of upstream activity.

Fusion avatar Aug 14 '17 00:08 Fusion

Working on it https://github.com/Papierkorb/qt5.cr - As the absolute major part of the wrappers are completely auto-generated, it'd take much more than a dev leaving from it to stop being up-to-date.

Papierkorb avatar Aug 26 '17 11:08 Papierkorb

Crystal rookie piping in here. In Ruby, I use GTK for any Linux projects needing a GUI. Is there a GTK library for Crystal yet?

HCLarsen avatar Sep 12 '17 18:09 HCLarsen

@HCLarsen I don't think there is.

As you'd probably know, GUI libraries have quite complex APIs requiring a big (though certainly manageable) effort to create proper bindings for Crystal (or any other language). Surely, someone will get at it eventually. But at the moment all you could do is start GTK bindings yourself.

straight-shoota avatar Sep 12 '17 21:09 straight-shoota

I'm aware of this one https://github.com/jhass/crystal-gobject

Also, for QT https://github.com/Papierkorb/qt5.cr

I'd like to help with GTK bindings (and Pantheon extensions lib for ElementaryOS, BTW). I started reading some GObject & G.Introspection docs but I'm a bit lost there.

We should join forces and make this happen!

PS: I found this projects on the very useful Reddit Crystal page https://www.reddit.com/r/crystal_programming/

Regards. Cristian

On Tue, Sep 12, 2017 at 6:28 PM, Johannes Müller [email protected] wrote:

@HCLarsen https://github.com/hclarsen I don't think there is.

As you'd probably know, GUI libraries have quite complex APIs requiring a big (though certainly manageable) effort to create proper bindings for Crystal (or any other language). Surely, someone will get at it eventually. But at the moment all you could do is start GTK bindings yourself.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/crystal-community/crystal-libraries-needed/issues/63#issuecomment-328989637, or mute the thread https://github.com/notifications/unsubscribe-auth/AAz4ZMzUw-Iq582LhcxlKUZuHUY0GZp4ks5shveDgaJpZM4O1mdX .

--

.^. In an open world, who needs windows or gates? /V\ Cristian Molina // \ GNU/Linux User #73047, Ubuntu User # 14733 /( _ )\ BsAs-Argentina ^^ ^^ ---------------------------------------------

megatux avatar Sep 12 '17 21:09 megatux

Yeah, the Ruby GTK library is quite large. I believe most of the process of creating a wrapper was automated using SWIG. Does anyone know if SWIG will support Crystal yet?

HCLarsen avatar Sep 13 '17 05:09 HCLarsen

@megatux I'd totally be in for joining forces to build a GTK library for Crystal. @straight-shoota has a point though, it's a large API, which means that doing it manually will be very intensive.

HCLarsen avatar Sep 13 '17 05:09 HCLarsen

Just a question, why not use qt? Its generally regarded as a much better and easier to use tool kit with a better community. And it has much better cross-platform support.

RX14 avatar Sep 13 '17 08:09 RX14

For me, it's a matter of experience. I already know GTK from using the Ruby library. Switching to QT would mean learning a whole new system.

HCLarsen avatar Sep 13 '17 16:09 HCLarsen

Plus, GTK uses CSS For styling. Does QT use CSS?

HCLarsen avatar Sep 13 '17 16:09 HCLarsen

I imagine learning Qt would be a lot lot easier than binding GTK in crystal (GTK is very weird with their gobject abstraction). I'm not sure if they use CSS in Qt but from a quick google I find this which suggests so.

RX14 avatar Sep 13 '17 16:09 RX14

Sure it'll be easier, but eventually the Crystal community is going to need more than one option. You don't to force every Crystal developer in the world into one framework.

HCLarsen avatar Sep 13 '17 19:09 HCLarsen

If you want to bind GTK to have ~~a horrific time~~ fun and bind GTK that's cool. I was just trying to make sure you understood that it's unlikely to be the best route if you wanted to actually get something built.

RX14 avatar Sep 13 '17 20:09 RX14

As I've already mentioned, I've used the Ruby GTK library in the past, and I did build things with it. The only horrific thing about it was the pitiful documentation by the owner of that particular library. As such, I don't understand your snarky comment that things can't get built with GTK.

HCLarsen avatar Sep 13 '17 20:09 HCLarsen

He wasn't talking about using GTK but making it usable in Crystal at all.

straight-shoota avatar Sep 13 '17 22:09 straight-shoota

I don't want to discuss what GUI toolkit is better. Both are great. I also looked at WXWidgets, because it's multiplatform & C++ and it's a popular choice, too. For desktop I prefer GTK+ (and I want to do ElementaryOS apps with Crystal, not Vala-lang!) but QT is very advance & for mobile QML looks awesome. I confess I'm a bit allergic to C++

I have no previous experience in creating a library binding, just basic knowledge of both QT with C++ and GTK+ with C and a little with Vala.

After trying to understand SWIG and GTK docs for G.Introspection, compilers calling conventions of C & C++, all the GTK+Ruby gems at https://github.com/mvz/gir_ffi and https://github.com/ruby-gnome2/ruby-gnome2#release-packages and even looked at https://github.com/olbat/libgen I ended up really overwhelmed and confused :)

I think we have a great opportunity to combine Crystal with good OO-GUI-libraries so killer apps start to emerge. I'm a bit tired of seeing so many new heavy-Electron-based-apps everywhere. I guess we just need some guidance and a bit of hard work.

Regards Cristian

On Wed, Sep 13, 2017 at 5:47 PM, Chris Larsen [email protected] wrote:

As I've already mentioned, I've used the Ruby GTK library in the past, and I did build things with it. The only horrific thing about it was the pitiful documentation by the owner of that particular library. As such, I don't understand your snarky comment that things can't get built with GTK.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/crystal-community/crystal-libraries-needed/issues/63#issuecomment-329292064, or mute the thread https://github.com/notifications/unsubscribe-auth/AAz4ZOzQQ2k51DhS_oTkJJKNNdnBpqOoks5siD9TgaJpZM4O1mdX .

--

.^. In an open world, who needs windows or gates? /V\ Cristian Molina // \ GNU/Linux User #73047, Ubuntu User # 14733 /( _ )\ BsAs-Argentina ^^ ^^ ---------------------------------------------

megatux avatar Sep 14 '17 03:09 megatux

Maybe I should open a new issue calling for Crystal support in SWIG. I do believe that would be outside of my range of ability. As I understand SWIG, it would make it a lot easier to create a GTK library for Crystal.

HCLarsen avatar Sep 14 '17 06:09 HCLarsen

It would be much easier to discuss if 'thread' wasn't still an alien concept in Crystal (yet) I suspect?

mjago avatar Dec 03 '17 14:12 mjago

What's got threading to do with GUI?

Papierkorb avatar Dec 03 '17 14:12 Papierkorb

Nothing if your program doesn't need to do any work

mjago avatar Dec 03 '17 15:12 mjago

Huh? C++/Qt programs run great even single-threaded. Concurrency != parallelism.

Papierkorb avatar Dec 03 '17 15:12 Papierkorb

I'm streaming audio in the background and can barely refresh curses - I wouldn't dream of streaming video - just saying

mjago avatar Dec 03 '17 15:12 mjago

Back to the main thread, I've started playing a little with crystal-gobject[1] trying to translate the Ruby's GTK+ bindings examples[2] and created a couple of GH issues when I found problems. So far so good. I'd like to add all GTK+ tutorial examples in the repository. I don't know of any relative non-trivial app made with this bindings, though.

Regards Cristian

[1] https://github.com/jhass/crystal-gobject/ [2] https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/tutorial

On Sun, Dec 3, 2017 at 12:12 PM, Martyn Jago [email protected] wrote:

I'm streaming audio in the background and can barely refresh curses - I wouldn't dream of streaming video - just saying

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/crystal-community/crystal-libraries-needed/issues/63#issuecomment-348781559, or mute the thread https://github.com/notifications/unsubscribe-auth/AAz4ZF_L0h_-9f2_Mz-D2pFLBo09nNyVks5s8rpNgaJpZM4O1mdX .

--

.^. In an open world, who needs windows or gates? /V\ Cristian Molina // \ GNU/Linux User #73047, Ubuntu User # 14733 /( _ )\ BsAs-Argentina ^^ ^^ ---------------------------------------------

megatux avatar Dec 03 '17 15:12 megatux

In case people have missed it, there are already Qt5 bindings https://github.com/Papierkorb/qt5.cr It's missing integration with libevent as of now. It can be done however, and once it is, it'll be far ahead in that Qt does much more for you than a common UI toolkit.

Papierkorb avatar Dec 03 '17 15:12 Papierkorb

@Papierkorb jog my memory. Is QT the one that you can use in any OS, and the windows will look native to that OS?

HCLarsen avatar Dec 03 '17 18:12 HCLarsen