Okay, well I'm having trouble getting a variable from one place to the other. I have two scripts: for now, let's call them MainScript.py and ChildScript.py.
#!/usr/bin/python # MainScript.py import ChildScript from Tkinter import * class GetVariable: def __init__(self): master = Tk() master.withdraw() ChildScript.VariableDialog(master) # From right here, I would like to be able to print the value of 'buttonstatus'. myapp = GetVariable()
#!/usr/bin/python # ChildScript.py import tkSimpleDialog from Tkinter import * class VariableDialog(tkSimpleDialog.Dialog): def body(self, master): self.status = IntVar() Checkbutton(master, text="Variable", variable=self.status).grid(row=1) def apply(self): buttonstatus = self.status.get() # Now, I have the status of the checkbutton locally. # How can I get it to the MainScript script?
However, I would like to do all of this without any globals. I resent them!
Thank you in advance.