【发布时间】:2015-05-08 07:04:00
【问题描述】:
lbl1 = Label(root, text="Target:").pack()
box1 = Entry(root).pack()
lbl2 = Label(root, text="Port:").pack()
box2 = Entry(root).pack()
ps_target = #value given to box1
我试图让我给 box1 的值出现在我的“ps_target”变量上。我该怎么做呢?我在 Python 2.7.6 中使用 Tkinter 模块。
如果您需要更多详细信息,请告诉我,我会尽可能提供。
【问题讨论】:
-
ps_target .set(box1.get())
-
文件 "/usr/lib/python2.7/lib-tk/Tkinter.py",第 1489 行,在 call 中返回 self.func(*args) 文件" test.py”,第 49 行,在 port_scan ps_target .set(ebox1.get()) NameError: global name 'ps_target' is not defined /:
-
试试@Leon 分享的链接
-
是 ps_target 只是一个将 box1 中的值串起来的变量吗?
-
没有它在不同的字符串“def port_scan(self)”
标签: python python-2.7 tkinter