How to use the imgui.new_frame function in imgui

To help you get started, we’ve selected a few imgui 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 swistakm / pyimgui / doc / examples / cocos2d.py View on Github external
def draw(self, *args, **kwargs):
        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()
github swistakm / pyimgui / doc / examples / glfw3.py View on Github external
def main():
    window = impl_glfw_init()
    impl = GlfwRenderer(window)

    while not glfw.window_should_close(window):
        glfw.poll_events()
        impl.process_inputs()

        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()
github swistakm / pyimgui / doc / examples / pygame_.py View on Github external
pygame.display.set_mode(size, pygame.DOUBLEBUF | pygame.OPENGL)

    io = imgui.get_io()
    io.fonts.add_font_default()
    io.display_size = size

    renderer = PygameRenderer()

    while 1:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

            renderer.process_event(event)

        imgui.new_frame()

        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()
github pthom / imgui_datascience / imgui_datascience / imgui_runner.py View on Github external
while 1:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                if on_exit:
                    on_exit()
                try:
                    sys.exit()
                except SystemExit as e:
                    time.sleep(0.5)
                    # sys.exit()
                    # sys.terminate()
                    os._exit(1)

            pygame_renderer.process_event(event)

        imgui.new_frame()
        if params.provide_default_window:
            imgui.set_next_window_position(0, 0)
            imgui.set_next_window_size(win_size[0], win_size[1])
            imgui.begin("Default window")
        gui_loop_function()
        if params.provide_default_window:
            imgui.end()
        ImGuiImageLister._heartbeat()

        # note: cannot use screen.fill((1, 1, 1)) because pygame's screen
        #       does not support fill() on OpenGL surfaces
        gl.glClearColor(1, 1, 1, 1)
        gl.glClear(gl.GL_COLOR_BUFFER_BIT)
        imgui.render()
        pygame_renderer.render(imgui.get_draw_data())
        pygame.display.flip()
github moderngl / moderngl-window / examples / integration_imgui.py View on Github external
def render_ui(self):
        imgui.new_frame()
        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
github swistakm / pyimgui / doc / examples / pyglet_.py View on Github external
def update(dt):
        imgui.new_frame()
        if imgui.begin_main_menu_bar():
            if imgui.begin_menu("File", True):

                clicked_quit, selected_quit = imgui.menu_item(
                    "Quit", 'Cmd+Q', False, True
                )

                if clicked_quit:
                    exit(1)

                imgui.end_menu()
            imgui.end_main_menu_bar()

        imgui.show_test_window()

        imgui.begin("Custom window", True)
github christopherdumas / atomicdatabase / AtomicDatabase / __main__.py View on Github external
show_save_as = False
    show_load_db = False

    TICK_INTERVAL = 30
    next_time = SDL_GetTicks() + TICK_INTERVAL;

    io = imgui.get_io()
    while running:
        while SDL_PollEvent(ctypes.byref(event)) != 0:
            if event.type == SDL_QUIT:
                running = False
                break
            renderer.process_event(event)
        renderer.process_inputs()

        imgui.new_frame()
        push_settings()

        if imgui.begin_main_menu_bar():
            (show_save_as, show_load_db) = draw_file_menu(show_save_as, show_load_db)

            # draw window menu
            if imgui.begin_menu("Window", True):
                for key in SHOW_VARS:
                    _, SHOW_VARS[key] = imgui.menu_item(
                        "Show " + key.title() + " View", selected=SHOW_VARS[key]
                    )

                imgui.end_menu()

            imgui.end_main_menu_bar()
github swistakm / pyimgui / doc / source / gen_example.py View on Github external
def _patch_imgui():
    if imgui.new_frame == new_frame:
        imgui.new_frame = _new_frame_patched

    _clear_mouse()
github swistakm / pyimgui / doc / source / gen_example.py View on Github external
def _patch_imgui():
    if imgui.new_frame == new_frame:
        imgui.new_frame = _new_frame_patched

    _clear_mouse()