我无法通过Vfrat,V_base,floss和constloss的值填充条目小部件。 任何人都可以让我知道如何填写值,一旦程序执行。Python tkinter条目小部件
import math
import matplotlib.pyplot as plt
import numpy as np
from decimal import Decimal
import sys
from Tkinter import *
def v_f_calculation():
v_line = 28.0
f_base = 100.0
f_top = 200.0
f_step = input('Enter the no of step of frequency')
V_frat = v_line/f_base
print 'vfrat is ', V_frat
freq = np.arange(f_base/f_step, f_top+(f_base/f_step), f_base/f_step)
print 'frequency is ', freq
print('length of freq = ',len(freq))
V_base = np.arange(f_base/f_step*V_frat, f_base*V_frat, f_base/f_step*V_frat)
print 'V_base is ', V_base
V_top = np.ones(len(freq)-len(V_base))*v_line
print 'V_top is = ', V_top
V_v_f = np.concatenate((V_base, V_top), axis = 0)
print 'V_v_f is = ',V_v_f
print 'length of V_V_F', len(V_v_f)
plt.figure(1)
plt.plot(freq, V_v_f, 'ro-')
plt.show()
return V_frat, V_base, V_top, V_v_f
def get_fric_windage_loss():
st_cr_lg = 120.0
f_base = 100.0
lg = 0.5
tot_iron_loss = 500.0
rt_od = 100.0
fric_loss = ((rt_od*10**(-3))*(st_cr_lg*(10**(-3)))*f_base**0.38)/(lg/1000)
cons_loss = fric_loss + tot_iron_loss
print 'friction loss is = ', fric_loss
print 'constant loss is = ', cons_loss
return fric_loss, cons_loss
def print_out(vf, floss):
mgui = Tk()
text = StringVar()
wer = IntVar()
mgui.geometry ('1200x1200')
mgui.title('Output Sheet')
mlabel1 = Label(text='Vfrat', fg='black', bg = 'white').place(x=210, y=20)
mentry1 = Entry(textvariable = vf[0], width = 5).place(x=210, y =45)
mlabel2 = Label(text='V_base', fg='black', bg = 'white').place(x=270, y=20)
mentry2 = Entry(textvariable = vf[1], width = 5).place(x=270, y =45)
mlabel3 = Label(text='floss', fg='black', bg = 'white').place(x=270, y=20)
mentry3 = Entry(textvariable = floss[0], width = 5).place(x=270, y =45)
mlabel4 = Label(text='const_loss', fg='black', bg = 'white').place(x=270, y=20)
mentry4 = Entry(textvariable = floss[1], width = 5).place(x=270, y =45)
return
mainloop()
if __name__ == '__main__':
vf = v_f_calculation()
floss = get_fric_windage_loss()
我无法通过Vfrat,V_base,floss和constloss的值填充条目窗口小部件。 任何人都可以让我知道如何填写值,一旦程序执行。
什么是“无法”是什么意思?什么阻止你这样做?你有错误吗?什么错误? –