How to use the nanogui.mainloop function in nanogui

To help you get started, we’ve selected a few nanogui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wjakob / nanogui / python / example1.py View on Github external
def keyboardEvent(self, key, scancode, action, modifiers):
        if super(TestApp, self).keyboardEvent(key, scancode,
                                              action, modifiers):
            return True
        if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
            self.setVisible(False)
            return True
        return False

if __name__ == "__main__":
    nanogui.init()
    test = TestApp()
    test.drawAll()
    test.setVisible(True)
    nanogui.mainloop()
    del test
    gc.collect()
    nanogui.shutdown()
github wjakob / nanogui / python / example1.py View on Github external
def keyboardEvent(self, key, scancode, action, modifiers):
        if super(TestApp, self).keyboardEvent(key, scancode,
                                              action, modifiers):
            return True
        if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
            self.setVisible(False)
            return True
        return False

if __name__ == "__main__":
    nanogui.init()
    test = TestApp()
    test.drawAll()
    test.setVisible(True)
    nanogui.mainloop()
    del test
    gc.collect()
    nanogui.shutdown()
github wjakob / nanogui / python / example3.py View on Github external
def cb2():
            self.setVisible(False)
        b.setCallback(cb2)

        self.performLayout()


if __name__ == "__main__":
    nanogui.init()
    test = TestApp()
    test.drawAll()
    test.setVisible(True)

    print("Launching detached mainloop")
    h = nanogui.mainloop(detach=test)

    print("Back in Python context")
    for i in range(10):
        print(i)
        time.sleep(1)
        if not nanogui.active():
            break

    h.join()
    nanogui.shutdown()
github wjakob / nanogui / python / example4.py View on Github external
def keyboardEvent(self, key, scancode, action, modifiers):
        if super(TestApp, self).keyboardEvent(key, scancode,
                                              action, modifiers):
            return True
        if key == glfw.KEY_ESCAPE and action == glfw.PRESS:
            self.setVisible(False)
            return True
        return False

if __name__ == "__main__":
    nanogui.init()
    test = TestApp()
    test.drawAll()
    test.setVisible(True)
    nanogui.mainloop()
    del test
    gc.collect()
    nanogui.shutdown()
github wjakob / nanogui / python / example2.py View on Github external
gui.addColorVariable("Color", *make_accessors("colvar")).setFinalCallback(cp_final_cb)

gui.addGroup("Other widgets")


def cb():
    print("Button pressed.")
gui.addButton("A button", cb)

screen.setVisible(True)
screen.performLayout()
window.center()

nanogui.mainloop()
screen = gui = window = None
gc.collect()
nanogui.shutdown()