def __init__(self, *args, **kwargs): #self._app = app = Application.instance self.__topwin = kwargs.pop('topwin') Group.__init__(self, *args, **kwargs) Button(self, text='Load *.mat', command=self.onLoadClick).pack() paramX = ParamItem(self) paramX.labelText = 'x = ' paramX.entryWidth = 6 paramX.pack() self.__paramX = paramX paramY = ParamItem(self) paramY.labelText = 'y = ' paramY.entryWidth = 6 paramY.pack() self.__paramY = paramY self.name = 'Load'
def appendAlgorithm(self, algorithm): #To do: when algo is reset, the frm should be removed for algoName in self.__frameDict: self.__frameDict[algoName]['frame'].pack_forget() frm = Frame(self) frm.pack() paramInfo = {} params = algorithm['parameters'] for idx, name in enumerate(params): param = params[name] paramitem = ParamItem(frm) paramitem.labelText = name paramitem.labelWidth = 5 paramitem.entryWidth = 8 if self.balloon: self.balloon.bind_widget(paramitem.label, balloonmsg=param.shortdesc) if param.type == 'int': paramitem.checkFunc = self._app.checkInt elif param.type == 'float': paramitem.checkFunc = self._app.checkFloat paramitem.grid(row=idx%self.__MAXROW, column=idx//self.__MAXROW) #self.__params[param.name] = {'gui':paramitem, 'meta':param} paramInfo[param.name] = {'gui':paramitem, 'meta':param} self.__algo = algorithm #self.__frameDict[algorithm.meta.name] = frm self.__frameDict[algorithm['name']] = dict(frame=frm, paramInfo=paramInfo) self.__params = paramInfo
def __init__(self, *args, **kwargs): timer = kwargs.pop('timer') self.__timer = timer Toplevel.__init__(self, *args, **kwargs) interval = ParamItem(self) interval.labelText = 'Interval (ms)' interval.entryText = str(timer.interval) interval.entryWidth = 5 interval.pack(side=TOP) self.interval = interval self.active = IntVar(timer.active) Checkbutton(self, text='Activate', variable=self.active, command=self.onActivateClick).pack(side=TOP) Button(self, text='OK', command=self.onOKClick).pack(side=TOP) def hide(): self.visible = False self.protocol('WM_DELETE_WINDOW', hide) self.__visible = True self.visible = False