How to find out control id on custom form in python

Hi,
I am new to python. I need to debug some code. In code that I have , a form opens on button click. In the code how can I trace this event. Similar tasks I want to do on other buttons on form in the project.

Thanks in advance.

Hello @Jenny1, welcome to the forums.

This is not a kind of programming I’ve done much, but no-one else seems to be answering, so I will.

If you are using an IDE to write your code (PyCharm is a popular one) it will let you set a breakpoint in your handler, then once it is reached, you can step through the lines looking at how the variables change. This kind of application usually has multiple threads. You will get to choose whether the whole thing stops, or just the thread handling the click.

If you are not able to run under the IDE, you should still be able to debug using pdb, which in simple use involves adding some code at the point you want first to stop. There’s enough to get you started in pdb — The Python Debugger — Python 3.12.1 documentation.