我有一个程序,通过使用netmiko库登录到设备来实现自动化。 Tkinter是提供诸如设备连接到用户名和密码等详细信息的前端。如果我把所有的东西放在一个程序中,它就可以工作。Tkinter GUI和导入python程序
现在我想要tkinter GUI程序使用导入功能分别调用程序。通过这样做,我想将从GUI前端重试的值传递给后端程序以执行某些功能。我卡住的地方是需要传递的一些值在从前端GUI收集的后端函数中。
似乎在导入程序不工作,任何帮助将不胜感激。
e1 e2和e3的值不在show_entry_details函数下通过在我导入的单独python文件中创建。
''' the code is regarding tkinter application which works at the front end to prompt user for some info, which later passes to other program to call some function.'''
# Head of Tkinter application
master = Tk()
master.title("Network Automation")
# configuration for the labels and entry
Label(master, text="Device : ").grid(row=0)
Label(master, text="User ID : ").grid(row=1)
Label(master, text="Password : ").grid(row=2)
e1 = Entry(master)
e2 = Entry(master)
e3 = Entry(master, show='*')
e1.grid(row=0, column=1)
e2.grid(row=1, column=1)
e3.grid(row=2, column=1,)
# configuration for the button
Button(master, text='Quit', command=master.destroy).grid(row=4, column=0, sticky=W, pady=4)
Button(master, text='Harden', command=show_entry_fields).grid(row=4, column=1, sticky=W, pady=4)
mainloop()
请发表您的代码。 – abagshaw
请提供[最小,完整和可验证示例](https://stackoverflow.com/help/mcve) –