Jul-28-2020, 05:36 PM
(This post was last modified: Jul-28-2020, 07:11 PM by Gribouillis.)
Hello everyone
Please help me solve my little problem.
Created an object in canvas tkinter (canvas.create_image(bot['coord'], image = bot['image'], tags = ('bot', bot ['name'], tag1))) and passed the dictionary as a tag (tag1) - {'name': 'bot_28', 'coord': (610, 160), 'health': 0.99, 'live': 0, 'age': 0, 'speed': 0.41, 'orient': 7, 'cargo': [], 'atak': 0.521, 'radar': 25, 'step': 0, 'near': [], 'image': <PIL.ImageTk.PhotoImage object at 0x000001D3269081D0>}. The dictionary in the tag gets the string type.
Now I need to extract it, but I can't convert it back from a string to a dictionary - an error appears ('str' object has no attribute 'keys' - I wanted to see all the dictionary keys). I don't know how to fix it?
Please help me solve my little problem.
Created an object in canvas tkinter (canvas.create_image(bot['coord'], image = bot['image'], tags = ('bot', bot ['name'], tag1))) and passed the dictionary as a tag (tag1) - {'name': 'bot_28', 'coord': (610, 160), 'health': 0.99, 'live': 0, 'age': 0, 'speed': 0.41, 'orient': 7, 'cargo': [], 'atak': 0.521, 'radar': 25, 'step': 0, 'near': [], 'image': <PIL.ImageTk.PhotoImage object at 0x000001D3269081D0>}. The dictionary in the tag gets the string type.
Now I need to extract it, but I can't convert it back from a string to a dictionary - an error appears ('str' object has no attribute 'keys' - I wanted to see all the dictionary keys). I don't know how to fix it?