我正在尝试自动清除Entry父小部件中的所有小部件。
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()
Run Code Online (Sandbox Code Playgroud)
我遇到了 3 个问题
wlist[0]以下与shell输出不同? 例如:
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()
Run Code Online (Sandbox Code Playgroud)
例如
>> re.search(r'Entry',wlist[0])
<< No output >>
Run Code Online (Sandbox Code Playgroud)
Entry部件,你将如何让部件对象本身执行delete方法调用?例如:
## 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)
Run Code Online (Sandbox Code Playgroud)