How to use the nanogui.GroupLayout 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 / example4.py View on Github external
def __init__(self):
        super(TestApp, self).__init__((800, 600), "NanoGUI Test", False)

        window = Window(self, "GLCanvas Demo")
        window.setPosition((15, 15))
        window.setLayout(GroupLayout())

        self.canvas = MyGLCanvas(window)
        self.canvas.setBackgroundColor(Color(0.5, 0.5, 0.5, 1.0))
        self.canvas.setSize((400, 400))

        self.canvas.rotation = [0.25, 0.5, 0.33]

        tools = Widget(window)
        tools.setLayout(BoxLayout(Orientation.Horizontal,
                                  Alignment.Middle, 0, 5))

        b0 = Button(tools, "Random Color")
        def cb0():
            self.canvas.setBackgroundColor(Color(random.random(), random.random(), random.random(), 1.0))
        b0.setCallback(cb0)
github wjakob / nanogui / python / example1.py View on Github external
def tab_cb(index):
            if index == (tabWidget.tabCount()-1):
                global counter
                # When the "+" tab has been clicked, simply add a new tab.
                tabName  = "Dynamic {0}".format(counter)
                layerDyn = tabWidget.createTab(index, tabName)
                layerDyn.setLayout(GroupLayout())
                Label(layerDyn, "Function graph widget", "sans-bold")
                graphDyn = Graph(layerDyn, "Dynamic function")

                graphDyn.setHeader("E = 2.35e-3")
                graphDyn.setFooter("Iteration {0}".format(index*counter))
                valuesDyn = [0.5 * abs((0.5 * math.sin(i / 10.0 + counter)) +
                                       (0.5 * math.cos(i / 23.0 + 1 + counter)))
                             for i in range(100)]
                graphDyn.setValues(valuesDyn)
                counter += 1
                # We must invoke perform layout from the screen instance to keep everything in order.
                # This is essential when creating tabs dynamically.
                self.performLayout()
                # Ensure that the newly added header is visible on screen
                tabWidget.ensureTabVisible(index)
github wjakob / nanogui / python / example1.py View on Github external
CheckBox(popup, "A check box")
        # popup right
        popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
        popupRight = popupBtn.popup()
        popupRight.setLayout(GroupLayout())
        CheckBox(popupRight, "Another check box")
        # popup left
        popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
        popupBtn.setSide(Popup.Side.Left)
        popupLeft = popupBtn.popup()
        popupLeft.setLayout(GroupLayout())
        CheckBox(popupLeft, "Another check box");

        window = Window(self, "Basic widgets")
        window.setPosition((200, 15))
        window.setLayout(GroupLayout())

        Label(window, "Message dialog", "sans-bold")
        tools = Widget(window)
        tools.setLayout(BoxLayout(Orientation.Horizontal,
                                  Alignment.Middle, 0, 6))

        def cb2(result):
            print("Dialog result: %i" % result)

        b = Button(tools, "Info")

        def cb():
            dlg = MessageDialog(self, MessageDialog.Type.Information, "Title",
                                "This is an information message")
            dlg.setCallback(cb2)
        b.setCallback(cb)
github wjakob / nanogui / python / example1.py View on Github external
CheckBox(popup, "A check box")
        # popup right
        popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
        popupRight = popupBtn.popup()
        popupRight.setLayout(GroupLayout())
        CheckBox(popupRight, "Another check box")
        # popup left
        popupBtn = PopupButton(popup, "Recursive popup", entypo.ICON_FLASH)
        popupBtn.setSide(Popup.Side.Left)
        popupLeft = popupBtn.popup()
        popupLeft.setLayout(GroupLayout())
        CheckBox(popupLeft, "Another check box");

        window = Window(self, "Basic widgets")
        window.setPosition((200, 15))
        window.setLayout(GroupLayout())

        Label(window, "Message dialog", "sans-bold")
        tools = Widget(window)
        tools.setLayout(BoxLayout(Orientation.Horizontal,
                                  Alignment.Middle, 0, 6))

        def cb2(result):
            print("Dialog result: %i" % result)

        b = Button(tools, "Info")

        def cb():
            dlg = MessageDialog(self, MessageDialog.Type.Information, "Title",
                                "This is an information message")
            dlg.setCallback(cb2)
        b.setCallback(cb)
github wjakob / nanogui / python / example1.py View on Github external
def tab_cb(index):
            if index == (tabWidget.tabCount()-1):
                global counter
                # When the "+" tab has been clicked, simply add a new tab.
                tabName  = "Dynamic {0}".format(counter)
                layerDyn = tabWidget.createTab(index, tabName)
                layerDyn.setLayout(GroupLayout())
                Label(layerDyn, "Function graph widget", "sans-bold")
                graphDyn = Graph(layerDyn, "Dynamic function")

                graphDyn.setHeader("E = 2.35e-3")
                graphDyn.setFooter("Iteration {0}".format(index*counter))
                valuesDyn = [0.5 * abs((0.5 * math.sin(i / 10.0 + counter)) +
                                       (0.5 * math.cos(i / 23.0 + 1 + counter)))
                             for i in range(100)]
                graphDyn.setValues(valuesDyn)
                counter += 1
                # We must invoke perform layout from the screen instance to keep everything in order.
                # This is essential when creating tabs dynamically.
                self.performLayout()
                # Ensure that the newly added header is visible on screen
                tabWidget.ensureTabVisible(index)