MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / obj_to_string_single_obj

Function obj_to_string_single_obj

PySimpleGUI/PySimpleGUI.py:20220–20232  ·  view source on GitHub ↗

Dumps an Object's values as a formatted string. Very nicely done. Great way to display an object's member variables in human form Returns only the top-most object's variables instead of drilling down to dispolay more :param obj: The object to display :type obj: (Any) :return:

(obj)

Source from the content-addressed store, hash-verified

20218
20219# Converts an object's contents into a nice printable string. Great for dumping debug data
20220def obj_to_string_single_obj(obj):
20221 """
20222 Dumps an Object's values as a formatted string. Very nicely done. Great way to display an object's member variables in human form
20223 Returns only the top-most object's variables instead of drilling down to dispolay more
20224 :param obj: The object to display
20225 :type obj: (Any)
20226 :return: Formatted output of the object's values
20227 :rtype: (str)
20228 """
20229 if obj is None:
20230 return 'None'
20231 return str(obj.__class__) + '\n' + '\n'.join(
20232 (repr(item) + ' = ' + repr(obj.__dict__[item]) for item in sorted(obj.__dict__)))
20233
20234
20235def obj_to_string(obj, extra=' '):

Callers 1

_table_clickedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected