Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Tkinter
- import re
- root=Tkinter.Tk()
- E1=Tkinter.Entry(root)
- E1.pack()
- E2=Tkinter.Entry(root)
- E2.pack()
- L1=Tkinter.Label(root,text='Label1')
- L1.pack()
- >> re.search(r'Entry',wlist[0])
- << No output >>
- ## Assuming I have a function to to clear the entry
- ## How would I pass the object from the pattern match in #2 to this function?
- def clear_entry(objEntry):
- objEntry.delete(0,Tkinter.END)
- >>> wlist[0].winfo_class()
- 'Entry'
- >>> isinstance(wlist[0], Tkinter.Entry)
- True
- for widget in root.winfo_children():
- if isinstance(widget, Tkinter.Entry):
- widget.delete(0, "end")
- entry_list=[E1, E2]
- def clear_entry():
- for id in entry_list:
- id.delete(0,Tkinter.END)
- if type(wlist[0]) == Tkinter.Entry: # True/False
- if isinstance(wlist[0], Tkinter.Entry): # True/False
- wlist[0].delete(0,Tkinter.END)
- clear_entry(wlist[0])
- print str(wlist[0])
- .353964488L
- print repr(wlist[0])
- <Tkinter.Entry instance at 0x00000000151911C8>
Add Comment
Please, Sign In to add comment