Created
May 20, 2009 12:11
-
-
Save qingfeng/114776 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # controller.py | |
| # sha1_pyobjc | |
| # | |
| # Created by yanxu on 09/05/18. | |
| # Copyright (c) 2009 SINA. All rights reserved. | |
| # | |
| from objc import YES, NO, IBAction, IBOutlet | |
| from Foundation import * | |
| from AppKit import * | |
| from hashlib import sha1 | |
| class controller(NSObject): | |
| text = IBOutlet("text") | |
| result = IBOutlet("result") | |
| # objc-style init, must return self | |
| def init(self): | |
| self = super(controller, self).init() | |
| return self | |
| def applicationDidFinishLaunching_(self, sender): | |
| NSLog("Start......") | |
| @IBAction | |
| def convert_(self,sender): | |
| v = self.text.stringValue() | |
| self.result.setStringValue_( sha1(v.encode("utf8")).hexdigest() ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment