我正在使用tkinter
基于类的结构,我需要获取文本输入的值。我怎么做?
以下是相关代码:
#GUI
class PseudostreamWidget(tk.Frame):
def __init__(self, master=None, **kw):
tk.Frame.__init__(self, master, **kw)
self.targetIP = tk.Entry(self.Ipconfig)
self.targetIP.configure(background='black', font='{Lato} 12 {}', foreground='white', highlightbackground='black')
self.targetIP.configure(highlightcolor='black', justify='left', relief='raised')
_text_ = '''Friend's Public IP Here'''
self.targetIP.delete('0', 'end')
self.targetIP.insert('0', _text_)
self.targetIP.grid(column='1', row='0')
#
#
#
target_ip = self.targetIP
#
#
我如何让它target_ip
在课外打印?
if __name__ == '__main__':
root = tk.Tk()
widget = PseudostreamWidget(root)
widget.pack(expand=True, fill='both')
root.mainloop()
print(target_ip)