/Tests/25-password.py

https://bitbucket.org/alsh/pygui-mirror · Python · 25 lines · 19 code · 6 blank · 0 comment · 0 complexity · ab29187eac30fb7ec99e6c9c7d240909 MD5 · raw file

  1. from GUI import Window, TextField, Button, application
  2. def show(tf):
  3. print "Text = %r" % tf.text
  4. def make_window():
  5. win = Window(size = (240, 100), title = "Password")
  6. tf = TextField(position = (20, 20), width = 200, password = True)
  7. ok = Button("OK", position = (20, 60), action = (show, tf))
  8. win.add(tf)
  9. win.add(ok)
  10. win.show()
  11. make_window()
  12. instructions = """
  13. There should be a window containing a password entry field.
  14. Text in the field should be obfuscated, and it should not be
  15. possible to copy text out of the field. The OK button should
  16. cause the contents of the field to be reported.
  17. """
  18. print instructions
  19. application().run()