来自标签条目的存储值

时间:2018-05-08 21:25:58

标签: python numpy storage

我正在研究appJar以显示我的答案。我使用getLabel获取我的输入值,但后来我想用那些(np)操作。那么,我如何使用条目值进行操作?

import numpy as np
from appJar import gui 

def launch(win):
    app.showSubWindow(win)

app=gui("JM-UofA2018","600x100")

#Title
app.addLabel("title", "Welcome to Open Pit Design-Angles Tool")
app.setLabelBg("title", "red")
app.setLabelFg("title", "blue")
#Label Instructions
app.addLabel("Select one Button:")
# these go in the main window
app.addButtons(["Catch Bench (CB)","Horizontal Distance (HD)","Bench Face Angle (BFA)"], launch)


def press(button):
    if button == "Cancel":
        app.stop() 
    else:
        app.getLabel("Height")
        app.getLabel("IRA")
        app.getLabel("BFA")

        CB = (Height*((1/(np.tan(IRA*np.pi/180))-(1/(np.tan(BFA*np.pi/180))))))
        print(CB)

app.startSubWindow("Catch Bench (CB)", modal=True)
app.addLabel("l1", "Input: Height,IRA and BFA")
app.addLabel("Height")
app.addNumericEntry("Height")
app.addLabel("IRA")
app.addNumericEntry("IRA")

app.addLabel("BFA")
app.addNumericEntry("BFA")

app.addButtons(["Accept", "Cancel"], press)
app.stopSubWindow()

app.go()

1 个答案:

答案 0 :(得分:0)

getLabel()返回标签的字符串内容,但您需要用户输入数据的数字条目的内容,因此请改用getNumericEntry()

您还需要将这些返回的,用户输入的值分配给相应的变量(您当前尝试使用这些变量而未定义)。例如:

IRA = app.getNumericEntry("IRA")