question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DearPyGUI callback raises number arguments error

See original GitHub issue

Python code using dearpygui that works in the interpreter, is raising a num arguments error for the Nuitka compiled version. Tested on Windows and Ubuntu with Python 3.9 and 3.10 with the same results - implying the issue is not related to Python version, c compiler, or OS.

I tried two versions of Nuitka, 0.7.7 and 0.8rc9,

$ python -m nuitka --version
0.7.7
Commercial: None
Python: 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0]
Flavor: Anaconda Python
Executable: /home/martin/miniconda3/envs/dearpygui/bin/python
OS: Linux
Arch: x86_64
Distribution: Ubuntu (based on Debian) 20.04.4

$ python -m nuitka --version
0.8rc9
Commercial: None
Python: 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0]
Flavor: Anaconda Python
Executable: /home/martin/miniconda3/envs/dearpygui/bin/python
OS: Linux
Arch: x86_64
Distribution: Ubuntu (based on Debian) 20.04.4

pip was used to install Nuitka.

dearpygui version is 1.5.1. Install: pip install dearpygui. dearpygui

Reproducible snippet,

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(height=200, width=200)
dpg.setup_dearpygui()

# works
def cb_button1(sender, app_data, user_data):
    print(f"sender: {sender} {app_data} {user_data}")


class myClass(object):

    def __init__(self):
        pass

    # throws num arguments error
    def cb_button2(self, sender, app_data, user_data):
        print(f"sender: {sender} {app_data} {user_data}")


myclass = myClass()

with dpg.window(label="Example", height=100, width=100):
    dpg.add_text("Hello world")
    dpg.add_button(tag="b1", label="Button1", callback=cb_button1)  
    dpg.add_button(tag="b2", label="Button2", callback=myclass.cb_button2)  


dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Output of program,

$ ./nuitka_01.bin
sender: b1 None None
TypeError: myClass.cb_button2() takes 4 positional arguments but 5 were given
  • Provide in your issue the Nuitka options used
python -m nuitka --standalone --onefile nuitka_01.py

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kayhayencommented, Dec 16, 2022

The fix for this is in DPG, nothing Nuitka itself can do about it.

1reaction
kayhayencommented, Apr 20, 2022

Well, or you could add a fake self argument to eat up the self they provide, but I understand there is an upstream patch in the works. Thanks for this, helps me a lot. I wouldn’t have the time to do it, glad you are taking it on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dear PyGui documentation - Read the Docs
Helper to manually clip large list of items. Increases performance by not searching or drawing widgets outside of the clipped region. Parameters. label...
Read more >
MessageBox in DearPyGui - python - Stack Overflow
Is it possible to easily implement such a messagebox in DearPyGui ... callback = choiceAdd, user_data = [a]) dpg.add_button("subtract", ...
Read more >
DearPyGui - Bountysource
DearPyGui: A GPU Accelerated Python GUI Framework ... DearPyGUI callback raises number arguments error when app is compiled with Nuitka $ 0.
Read more >
List of issues - Issues with patch - Python tracker
ID Activity Status Creator 45950 8 months ago open christian.heimes 45847 8 months ago open christian.heimes 45193 8 months ago open taleinat
Read more >
Making a Live Dev Environment in DPG - I Suck At Coding
We create an input window; The execution callback injects our code into the live program ... import dearpygui.core as c import dearpygui.simple as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found