text.set_text(txt) def bdotclick(event): val = '.' # get existing text box text txt = text.get_text() # append text txt = txt + val # update text box text text.set_text(txt) def bacclick(event): val = '' text.set_text(val) f=g.frame(1,"calculator",510,400) text=g.text_field() text.pos=(20,10) text.size=(480,40) text.label="" f.append(text) #nums' bac=g.button() bac.label="AC" bac.size=(80,60) bac.pos=(300,60) bac.onclick(bacclick) f.append(bac)
from anygui import anywx as g f = g.frame(1, "sample GUI Window", 750, 500) user = g.text_field() user.size = (100, 50) user.pos = (50, 40) lb1 = g.static_text() lb1.pos = (50, 20) lb1.size = (100, 20) lb1.label = "Name" f.append(lb1) f.append(user) user2 = g.text_field() user2.size = (100, 50) user2.pos = (50, 120) lb2 = g.static_text() lb2.pos = (50, 100) lb2.size = (100, 20) lb2.label = "Entry Number" f.append(lb2) f.append(user2) tbox = g.text_area() tbox.pos = (300, 40) tbox.size = (400, 130) f.append(tbox)
if (not isAlphaNumeric(self.new.get_text())): print 'Password is not alphanumeric:' return False else: if (self.new.get_text() != self.repeat.get_text()): print print 'Passwords do not match:' return False else: print 'Congrats!' return True if __name__ == '__main__': f = g.frame(1, "password checker", 510, 300) user = g.text_field() user.pos = (20, 20) user.size = (170, 30) user.label = "user name" f.append(user) old = g.text_field2() old.pos = (20, 60) old.size = (170, 30) old.label = "old password" f.append(old) new = g.text_field2() new.pos = (20, 100)
elif(str(NewPstbps1).isdigit()): #Invalidates if password contains only digits not a combination. print(" Error !!!!! Entered password containg only numeral.Enter alphanumeric values") return False else : #print ("Password Successfully Changed. !"); print (" Your Password Is Successfully Changed :)"); return True else: # Invalidates if password have non-alphanumeric characters. print (" Error !!!!! Special characters are not allowed.Enter only alphamueric values "); return False #Constructor canvas if __name__=='__main__': f=g.frame(1,"password checker",510,300) usrtb=g.text_field() usrtb.pos=(20,20) usrtb.size=(100,20) usrtb.label="usrtb name" f.add(usrtb) OldPstb=g.text_field() OldPstb.pos=(20,50) OldPstb.size=(100,20) OldPstb.label="OldPstb password" f.add(OldPstb)