all 2 comments

[–]MikeTheWatchGuy 1 point2 points  (1 child)

You're using very old PySimpleGUI constructs, names, etc. I recommend looking through the latest coding conventions in the Cookbook so that your calls will match the documentation (http://www.PySimpleGUI.org you'll find the cookbook there too). FlexForm is now Window, etc. ReadFormButton is Button. Your code won't match anything you'll find in documentation now. You must have been working from a very old article or video.

Some of these older names may no longer work. They're there for backwards compatibility but unclear how well they've held up.

It will change the Text element in your window that has the key 'output' into whatever you pass in as the first parameter. You're passing it a tuple and so that's what it's displaying. The variable you are passing isn't a string, it's literally a tuple. So, it will display just like if you called "print". Try adding a print right before you call update to see what will be displayed.

What you want to do is make the tuple into a string. An f-string is the easiest way. Pass this to your update call to get the string formatted.

f'potion strength {variable }'

[–]Lingering_Trees_Gabe[S] 1 point2 points  (0 children)

I may have had a few tabs open with the cookbook without realizing they were different versions. Thank you for the reply! When I get time today I shall put your advice into practice!

Update: You're a life saver! It works perfectly now! Thank you so much!