Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_text_point raises exceptions even when used with only required inputs #2108

Closed
MathiasToftas opened this issue Jun 16, 2023 · 0 comments · Fixed by #2275
Closed

add_text_point raises exceptions even when used with only required inputs #2108

MathiasToftas opened this issue Jun 16, 2023 · 0 comments · Fixed by #2275
Labels
state: pending not addressed yet type: bug bug

Comments

@MathiasToftas
Copy link

Version of Dear PyGui

Version: 1.9.1
Operating System: Windows 10 and WSL2 Ubuntu 22.04.2 LTS (tested on both, got same result)
Python Version: 3.10.6

My Issue/Question

"add_text_point" raises exceptions "Exception: Error: [1000] Message: Not enough arguments provided. Expected: 5 Recieved: 2" and "Exception: Error: [1008] Message: Python value error. Must be int." when used in a plot, depending on what inputs you give it. I've included the error logs as comments in the minimal example to make clear which inputs caused which errors.

To Reproduce

  1. create a minimal dearpygui program
  2. add a window
  3. add a plot to the window
  4. add a text point to the plot
  5. run

see the minimal example for details

Expected behavior

A string of text should be visible in the plot, something like is seen in this resolved issue

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

dpg.create_context()

with dpg.window():
    with dpg.plot():
        x_axis = dpg.add_plot_axis(dpg.mvXAxis, tag="x_axis")
        y_axis = dpg.add_plot_axis(dpg.mvYAxis, tag="y_axis")

        # What I expect to to work based on other plot "add_" commands
        dpg.add_text_point(1.0, 1.0, label="hello", parent="y_axis")
        # The above gives the error
        """
        Exception: Error: [1008] Message:       Python value error. Must be int.

        The above exception was the direct cause of the following exception:

        Traceback (most recent call last):
        File "<path on my machine>\add_text_point.py", line 11, in <module>
            dpg.add_text_point(1.0, 1.0, label="hello", parent="y_axis")
        File "<path on my machine>\lib\site-packages\dearpygui\dearpygui.py", line 7081, in add_text_point
            return internal_dpg.add_text_point(x, y, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, parent=parent, before=before, source=source, show=show, x_offset=x_offset, y_offset=y_offset, vertical=vertical, **kwargs)
        SystemError: <built-in function add_text_point> returned a result with an exception set
        """

        # The "Must be int" maybe refers to the x/y offset?
        dpg.add_text_point(
            1.0, 1.0, label="hello", x_offset=1, y_offset=1, parent="y_axis"
        )
        # Trying the above gives the new error:
        """
        Exception: Error: [1000] Message:       Not enough arguments provided. Expected: 5 Recieved: 2

        The above exception was the direct cause of the following exception:

        Traceback (most recent call last):
        File "<path on my machine>\add_text_point.py", line 27, in <module>
            dpg.add_text_point(
        File "<path on my machine>\lib\site-packages\dearpygui\dearpygui.py", line 7081, in add_text_point
            return internal_dpg.add_text_point(x, y, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, parent=parent, before=before, source=source, show=show, x_offset=x_offset, y_offset=y_offset, vertical=vertical, **kwargs)
        SystemError: <built-in function add_text_point> returned a result with an exception set
        """

        # "Not enough arguments"... maybe if i explicitly set all arguments?
        dpg.add_text_point(
            1.0,
            1.0,
            label="hello",
            user_data=None,
            use_internal_label=True,
            tag="my-point",
            parent="y_axis",
            before=0,
            source=0,
            show=True,
            x_offset=1,
            y_offset=1,
            vertical=False,
        )
        # Trying the above gives the same error as the previous attempt


dpg.create_viewport(title="Minimum Example", width=600, height=200)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
1 participant