Town Field Poem:
The Pure Heart sentiment wisdom language, does not have the world name and the benefit. Learn water under the hundred rivers, give up arrogant slow meaning.
Learn to have a small return to feed root, willing to cast a conscience blog. Sincere in this writing experience, willing to see the text to inspire.
——————————————————————————————————————————
Code
From tkinter Import *root = Tk () def test (content,reason,name): if content = = "House fame":p rint (' correct ') print (content, reason,name) Return Trueelse:print (' Error ') print (content, reason,name) return Falsev=stringvar () testcmd=root.register (test) # Need to wrap the function, necessary e1=entry (root, Textvariable=v, validate= ' Focusout ', validatecommand= (testCMD, '%P ', '%v ', '%W ') #%p represents This value is valid when the value of the input box is allowed to change. The value is the current text box contents #%v (lowercase uppercase), the current validate value #%w represents the name of the component) E1.pack () Mainloop ()
Result
============ restart:c:\users\administrator\desktop\code_idle.py ============
P2
============ restart:c:\users\administrator\desktop\code_idle.py ============ Error Blog Park focusout. 53911680
P3
============ restart:c:\users\administrator\desktop\code_idle.py ============ Error Blog Park focusout. 53911680 right to give up fame and wealth Focusout .53911680
Close the form
——————————————————————————————————————————
The essence of the blog, in the technical part, more in the town yard a poem. Python version 3.5, System Windows7.
Python is a good language and deserves to be studied hard. I am following the small Turtle Video tutorial to learn, recommended.
I am a novice, so if the content of the blog can be improved, or even the wrong place, please leave a comment, I will try to correct, strive to achieve a conscience blog.
Note: This article is only as a scientific research study, if I inadvertently violated your rights and interests, please be sure to timely inform, I will make corrections.
Python3 Tkinter Basic Entry root.register wrapper function Validatecommand has%P%v%W incoming value of the current input box and validate