def onMakeCommand(self): new = Toplevel() # a new top-level window new.title('Enter Python command') # arbitrary python code frm = frame(new, TOP) label(frm, LEFT, '>>>') ent = StringVar() entry(frm, LEFT, ent) button(frm, RIGHT, 'Run', lambda s=self, e=ent: s.onCommand(e))
def __init__(self, **args): Toplevel.__init__(self) label(self, TOP, 'PyCalc Plus - Container') self.calc = apply(CalcGui, (self, ), args) frm = frame(self, BOTTOM) extras = [('sqrt', 'sqrt(%s)'), ('x^2 ', '(%s)**2'), ('x^3 ', '(%s)**3'), ('1/x ', '1.0/(%s)')] for (lab, expr) in extras: button(frm, LEFT, lab, (lambda m=self.onExtra, e=expr: m(e))) button(frm, LEFT, ' pi ', self.onPi)
def __init__(self, **args): Toplevel.__init__(self) label(self, TOP, 'PyCalc Plus - Container') self.calc = apply(CalcGui, (self,), args) frm = frame(self, BOTTOM) extras = [('sqrt', 'sqrt(%s)'), ('x^2 ', '(%s)**2'), ('x^3 ', '(%s)**3'), ('1/x ', '1.0/(%s)')] for (lab, expr) in extras: button(frm, LEFT, lab, (lambda m=self.onExtra, e=expr: m(e)) ) button(frm, LEFT, ' pi ', self.onPi)