Giter Club home page Giter Club logo

Comments (4)

joaoventura avatar joaoventura commented on September 26, 2024

Hi there, I would like to cover all the libui API, but currently I'm not actively developing for pylibui as I have other priorities right now. But I strongly suggest you to try to generate the bindings as it is really simple: https://github.com/joaoventura/pylibui#contributing

Start by checking which functions on libui you need to generate the bindings for: https://github.com/andlabs/libui/blob/master/ui.h#L211

Then use the script in bindings.py to build the wrappers to those functions, which then you have to manually generate the code (you can check the other examples).. Then you can make (or not) the higher level python API (or just use the wrapper you implemented). It's not really that hard, you just need to look around and test things..

from pylibui.

 avatar commented on September 26, 2024

Can I work on this please? Maybe I can help some. I ran bindings.py file for combobox and get something like this:

"""
 Python wrapper for libui.

"""

import ctypes
from . import clibui


class uiCombobox(ctypes.Structure):
    """Wrapper for the uiCombobox C struct."""

    pass


def uiComboboxPointer(obj):
    """
    Casts an object to uiCombobox pointer type.

    :param obj: a generic object
    :return: uiCombobox
    """

    return ctypes.cast(obj, ctypes.POINTER(uiCombobox))


# - void uiComboboxAppend(uiCombobox *c, const char *text);
def uiComboboxAppend(*args):
    """
    Describe the function.

    :param args: arguments
    :return: value
    """

    # TODO
    return clibui.uiComboboxAppend()


# - int uiComboboxSelected(uiCombobox *c);
def uiComboboxSelected(*args):
    """
    Describe the function.

    :param args: arguments
    :return: value
    """

    # TODO
    return clibui.uiComboboxSelected()


# - void uiComboboxSetSelected(uiCombobox *c, int n);
def uiComboboxSetSelected(*args):
    """
    Describe the function.

    :param args: arguments
    :return: value
    """

    # TODO
    return clibui.uiComboboxSetSelected()


# - void uiComboboxOnSelected(uiCombobox *c, void (*f)(uiCombobox *c, void *data), void *data);
def uiComboboxOnSelected(*args):
    """
    Describe the function.

    :param args: arguments
    :return: value
    """

    # TODO
    return clibui.uiComboboxOnSelected()

What is this and what should I do now?

from pylibui.

LordZane avatar LordZane commented on September 26, 2024

You have to write a higher level binding around it, look at the other examples here.

from pylibui.

joaoventura avatar joaoventura commented on September 26, 2024

You first have to create the ctypes bindings for it, check examples here, then you can add an higher level binding as @LordZane mentioned.

from pylibui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.