lgi-devs / lgi

Dynamic Lua binding to GObject libraries using GObject-Introspection
MIT License
434 stars 69 forks source link

no wiki, poor documentation, little community [closed] #256

Open jerome-diver opened 3 years ago

jerome-diver commented 3 years ago

Hi, i have big pain to find any didactic and useful information around lgi and also goo canvas and all that is over. Can you link some nice references to help dev users to win a bit of time to learn how to use this ? Maybe there is something usefull to do on this point, i really would like to help on that, but... i feel myself locked and stick with my miss-understanding of lgi, and GooCanvas and GTK and Cairo all around. I just arrived with help to build 3 rectangle's shapes and handle mouse event (and, because of big help, if not, i would never be able in this year to just do that, even if i know to use other GUI, not only wrappers around also) then build a collid test who miserably failed because of, i think, a bad event managment (not from lgi, but from myself, because i not really understand what i have to do to fix the problem as long as the lgi and gtk and cairo and goo canvas doc is poor and example also with mouse event and canvas especialy). What do you think about that ? Any plan to ask dev to help make something useful for information around ?

psychon commented 3 years ago

Well... I am not quite sure how I can help you. You mentioned these lbibraries:

I never used GooCanvas, buts its docs even start with an introduction with some examples.

Could you perhaps ask some more concrete question? Or is the above already helpful? If not, what is missing?

jerome-diver commented 3 years ago

Thank you for your quick answer. Precisely, what's missing i think is a real documentation who explain what is GTK objects, Cairo objetcs, Glib, and so on... what are they doing and how they are working together. So it should be not only lgi specific question, but it would be positive to get this somewhere if not everywhere (i mean oficialy at any point). Also, look at the API, it is better than nothing, but clearly there is many methods who are poor description if nothing (and specialy about there arguments that for some of them i can loose hours to find what is it and how can i get it, like a "canvas context" for example). If you think documentation is nice and enough, just close and delete my question. At this point i feel like it is an evidence that GTK and wrapper around has not enough clear and quality documentation to help new dev user with that (i do compared with Qt, can you have a look at the Qt doc to compare please ? you will see better what i mean). thank you again.

psychon commented 3 years ago

I am not sure how I can help you, so... uhm...

cairo just does drawing. Like "draw a line in red from (50, 30) to (100, 20)". GTK does "window stuff", like open a window with this button placed like this etc. GTK uses cairo for drawing. GLib is "low level system stuff" and datastructures. For example, it implements things like a list of objects (LinkedList in Java or std::vector in C++ (yes, I know that a vector is not a linked list, but you get the idea)).

I do not know what GooCanvas does, but it looks like it simplifies drawing widgets with GTK/cairo. With GTK, you have to be able to redraw your whole widget all the time. Everything that is visible can get lost (for $REASONS) and needs to be redrawn. With GooCanvas, you can place a circle at some specific coordinates and that circle stays there and is automatically redrawn when needed.

Personally, I do not have much clue about GTK/GLib/... and never used them much, but I have more or less success with navigating the references.

Oh one important ingredient is GObject. This is another library (that uses GLib, I think...). It implements an object system. In C++ you would call this class. But it supports GObject introspection. For example "dear object, which properties do you have?". This basically makes the API documentations machine-readable. LGI is short for Lua GObject Introspection. It uses this machine readable API documentation and makes the API accessible to Lua. Similar projects exists for lots of programming languages: https://gi.readthedocs.io/en/latest/users.html

Good luck and feel free to ask some questions.

jerome-diver commented 3 years ago

ho, i see in the sample directory the gtk-demo/main.lua who seems to me very nice to show some minimal uses of lgi... that is nice and help me a lot.