def RegisterArea(root): _value = DoubleVar(value=store[AREA_LABEL]) widgets = addWidgets(root, AREA_LABEL, _value) event = setParam(AREA_LABEL, _value, VAR_DOUBLE_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def RegisterOperator(root): _value = DoubleVar() widgets = addWidgets(root, OPERATOR_LABEL, _value) event = setParam(OPERATOR_LABEL, _value, VAR_STR_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def RegisterGravity(root): _value = DoubleVar(value=store[GRAVITY_LABEL]) widgets = addWidgets(root, GRAVITY_LABEL, _value) event = setParam(GRAVITY_LABEL, _value, VAR_DOUBLE_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def RegisterVolume(root): _value = DoubleVar() widgets = addWidgets(root, VOLUME_LABEL, _value) event = setParam(VOLUME_LABEL, _value, VAR_DOUBLE_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def RegisterCelsius(root): _value = DoubleVar(value=store[CELSIUS_LABEL]) widgets = addWidgets(root, CELSIUS_LABEL, _value) event = setParam(CELSIUS_LABEL, _value, VAR_DOUBLE_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def RegisterAtmospheric(root): _value = DoubleVar(value=store[ATMOSPHERIC_LABEL]) widgts = addWidgets(root, ATMOSPHERIC_LABEL, _value) event = setParam(ATMOSPHERIC_LABEL, _value, DoubleVar) addCommand(widgts, text=ENSURE_LABEL, event=event) return _value
def RegisterDensity(root): _value = DoubleVar(value=store[DENSITY_LABEL]) widgets = addWidgets(root, DENSITY_LABEL, _value) event = setParam(DENSITY_LABEL, _value, VAR_STR_TYPE) addCommand(widgets, text=ENSURE_LABEL, event=event) return _value
def main(): window, size = Window() sidebar = LoadSidebar(window) navigator = LoadNavigator(window, size) canvas, charts = LoadCanvas(window, size) status = StringVar(value=WAITING) # 程序状态 1. 未开始 2. 计算中 3. 结果 updateStatus = bindStatus(status) addLabel(navigator, status) addCommand(sidebar, COMPUTE_LABEL_P, startFetch(FETCH_P, updateStatus)) addCommand(sidebar, COMPUTE_LABEL_V, startFetch(FETCH_V, updateStatus)) addCommand(sidebar, CLEAR_LABEL, clearUI(updateStatus)) addCommand(sidebar, SAVE_LABEL, save) addCommand(sidebar, UPLOAD_LABEL, upload) window.mainloop()