GithubHelp home page GithubHelp logo

panda3d-kivy's Introduction

Panda3D-Kivy

A Panda3D add-on for Kivy integration.

The aim is to make the integration of Kivy apps into a Panda3D application almost transparent. Potential uses include creating on-screen GUI, or even RTT 3D UI's.

Usage:

First, import panda3d_kivy.app.App - make sure you do this before importing any Kivy-related stuff:

from panda3d_kivy.app import App

Then, as usual in Kivy, create a subclass of this App, and use build() or the KV autoloading system to populate your widget tree:

from kivy.uix.button import Button

class Example(App):
    def build(self):
        return Button(text='Hello, world!')

You can then instantiate and run this app inside the __init__ of your Panda ShowBase, after running ShowBase.__init__(self). You may want to create a display region for your kivy app, sized according to your needs, otherwise panda3d_kivy will automatically create one for you that will occupy the entire window. You must then pass your ShowBase as argument to the Kivy app instantiation, as well as your display region if applicable, and finally call app.run() as you normally would:

from direct.showbase.ShowBase import ShowBase

class PandaApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)

        self.kivy_app = kivy_app = Example(self)
        kivy_app.run()

        # The rest of your ShowBase code here

Voilà! You should have a working Kivy UI in your Panda application. Have fun!

panda3d-kivy's People

Contributors

cheaterman avatar moguri 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.