Giter Club home page Giter Club logo

pylibui's Introduction

pylibui

Build Status

Python3 wrapper for libui. It uses ctypes to interface with the libui shared library.

Usage

from pylibui.core import App
from pylibui.controls import Window


class MyWindow(Window):

    def onClose(self, data):
        super().onClose(data)
        app.stop()


app = App()

window = MyWindow('Window', 800, 600)
window.setMargined(True)
window.show()

app.start()
app.close()

Build instructions

Clone pylibui:

$ git clone https://github.com/joaoventura/pylibui

Clone libui and build the shared library:

$ git clone https://github.com/andlabs/libui/
$ cd libui
$ mkdir build
$ cd build
$ cmake ..
$ make

The libui shared library will be inside libui/build/out. Copy the contents of out/ to pylibui/libui/sharedlibs. Now, you can use pylibui:

$ python3
>>> import pylibui

Run Tests

The tests are located in the tests folder. To run the entire test suite execute the following in the outer pylibui directory:

$ python3 -m unittest
..
----------------------------------------------------------------------
Ran 20 tests in 0.055s

Ok

To execute a single test file:

$ python3 -m unittest tests/test_window.py
..
----------------------------------------------------------------------
Ran 2 tests in 0.033s

Ok

Contributing

The project is divided in two major sections:

  • pylibui.libui: a ctypes wrapper around the libui C shared library.
  • pylibui: an object oriented pythonic wrapper that makes calls to pylibui.libui.

If you want to contribute, these are the two places that you can implement some code and make a pull request.

If the functionality you are looking for is still not implemented in the pylibui.libui ctypes wrapper, there's two things you may need to do:

  • Implement the function if the function header is already declared (it will have a TODO in there).
  • Generate the function. Use the bindings.py script in scripts/ to generate most of the function declarations for a given section of the "ui.h" header file.

If you need to use the bindings.py file, just run it changing the section that you want to generate the bindings, copy-paste the contents to an empty file, and implement the ctypes calls. Most of them are easy, but you can check what's already done for some guidance.

I'm accepting pull requests if the code is clean and it comes with a working example.

pylibui's People

Contributors

joaoventura avatar superzazu avatar waghanza avatar mark-summerfield avatar tiagodanin avatar ditti4 avatar

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.