How to inspect variables like nestetd lists or tuples.

166 views
Skip to first unread message

Peter Hafenbrak

unread,
May 20, 2023, 7:38:24 AM5/20/23
to thonny
I'm working with Thonny on a raspi 4B primarily with python. I am absolutely satisfied with Thonny for my requirements, except for "inspection of list and tuple variables", especially if these are still nested.
Right now I didn't find a way to scroll horizontally in a variable in the variable pane of Thonny.
Has anybody an idea or an trick to inspect such variables? 
Thanks in advace.
Peter

Thonny_variable_scrolling.jpg

Aivar Annamaa

unread,
May 20, 2023, 9:57:46 AM5/20/23
to thonny
You can open the Object Inspector from the View menu. Then, after you select a variable, corresponding object is presented in the Object Inspector. 
In the object inspector you can "drill down" by double-clicking an item or field. You can go back to previous object using the left arrow button in the header of the Object inspector.

(You may wonder why does Thonny have separate view for this instead of allowing investigating the structure of the object in the variables view. I simply wanted to stress the difference between variable and object. As you can see, the Object inspector labels the object by its address, not name. This is meant to illustrate that you don't need variables to speak about objects. Try evaluating and expression in the Shell while the Object Inspector is open.)

Best regards,
Aivar

Peter Hafenbrak

unread,
May 21, 2023, 10:45:29 AM5/21/23
to thonny
Hallo Aivar,

great, this was the answer I was searching for.

Thank you very much, also for the fast response to my question.

Best regards

Peter

Reply all
Reply to author
Forward
0 new messages