python tkinter packing
问题 Could someone please explain why when you have an plain widget as one line Code A works Entry(root, width=10).pack(side=LEFT,anchor=W) but when you name it or attach a command to it, Code A no longer works and gives you Error Message B self.my_entry = Entry(root, width=10).pack(side=LEFT,anchor=W) and you must pack using a seperate line? self.my_entry = Entry(root, width=10) self.my_entry.pack(side=LEFT,anchor=W) Code A self.my_entry.get() Error Message B AttributeError: 'NoneType' object has