0

I am afraid that this is a 'how to' question. I have a function that returns three variables from a text file. I would like to 'print' them to separate label fields so that I can clearly highlight different information. I have only managed so far to combine them into one return statement using the .format notation. So I want to

return date, name, numeric_data

and want to be able, in tinter GUI

label_name.configure( text = date)
label_name2.configure( text = name)
label_name3.configure(text = numeric_data) 

At the moment, all I have is:

        output = read_clean_format.openfile() # which is return "{}{}{}".format(text,text,text)
        version_result.configure(text = output)

Is this possible? Where can I hunt information.

user1478335
  • 1,769
  • 5
  • 25
  • 37
  • Don't worry. Have found a (the?) solution on http://stackoverflow.com/questions/9752958/how-can-i-return-two-values-from-a-function-in-python – user1478335 May 16 '15 at 16:49

1 Answers1

0

There's nothing special you need to do -- have your function return three values, and then use those three values with configure statements like your code seems to show:

def openfile():
    ...
    return date, name, numeric_data

date, name, numeric_data = openfile()
label_name.configure(text=date)
label_name2.configure(text=name)
label_name3.configure(text=numeric_data)
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685