I've used tk a fair amount mostly by grabbing bits of code from the web and stitching them in. So I'm sort of familiar, but still confused, even after reading a couple of tutorials. I'm hoping someone will be nice enough to explain what's actually going on.
What I'm trying to do this time is go through a list of cases, and for any which meet the criteria, display the results as we go.
My flow is something like this:
set up tk text box
get a list of items (from an API call)
for item in list:
make a couple of API calls to get data on the item
do some processing
if item meets criteria:
find item's position in the list of criteria-meeting items (i.e. i'm sorting as I go)
insert item[details] in text box at the relevant position
So it's really not hard. Left to myself I would probably create the window as a class
then refer to it in the main code with a sort of window.update(text, position)
function. But I know I need to put mainloop()
in there somewhere (where?), and it's at this point that I realise I fundamentally don't understand how tk works, so I know when I write the code it won't work, I won't know what's wrong, and I'll end up stitching together stuff that I find on the web, unless someone is good enough to tell me what's actually going on.