vendredi 20 février 2015

String from Object Python


Vote count:

0




I am working on a project that uses XML to create a Tkinter GUI and need to know how to convert an object name to a string. For example:


# In the actual program, the value of widget variables is set by the values of XML attributes


label_name = "mylabel"


root = Tk()


exec(label_name+" = Label("+str(root)+", text='Hello World')")


Using str(root) does not work... what can I do to make this work?



asked 40 secs ago







String from Object Python

Aucun commentaire:

Enregistrer un commentaire