if (do_name() != 'Home') : ?>
endif ?>
Posted by Sheng-Wu Chang on Jan 18, 2010
include("util/comment.php"); ?>
from AppKit import * class ComboBox(NSObject): def init(self, title="Label", list=[], default=""): r = NSMakeRect(150, 150, 150, 100) p = NSPanel.alloc().initWithContentRect_styleMask_backing_defer_(r, NSTitledWindowMask, NSBackingStoreBuffered, False) r = NSMakeRect(25, 60, 100, 25) t = NSTextField.alloc().initWithFrame_(r); t.setStringValue_(title) t.setEditable_(False) t.setSelectable_(False) t.setDrawsBackground_(False) t.setBezeled_(False) p.contentView().addSubview_(t) r = NSMakeRect(25, 25, 100, 25) c = NSComboBox.alloc().initWithFrame_(r); for edge in list: c.addItemWithObjectValue_(edge) c.setStringValue_(default) c.setTarget_(self) c.setAction_(self.hit) p.contentView().addSubview_(c) self.k = NSApp().keyWindow() NSApp().runModalForWindow_(p) def hit(self, sender): self.value = sender.stringValue() NSApp().stopModal() self.k.makeKeyWindow() """ usage: import ns ... if self.current.find("Edge") >= 0: self.node2 = EasyDialogs.AskString("Node2", default="[Node2]") c = ns.ComboBox.alloc() c.init(title="Edge", list=["type A", "type B", "type C", "type D"], default="type B") print "Edge:", c.value del c ... """I found finally this way helps me to dynamically customize control(s) what I want by leveraging Cocoa NSObject. Of course Carbon's EasyDialogs works somewhere, too.
EasyDialogs or Tkinter or ?
Posted by Sheng-Wu Chang on Jan 15, 2010 And you have to do one extra step:cp -p -R /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac [path to NodeBox]/NodeBox.app/Contents/Resources/lib/python2.5/
Above codes are adapted from http://nodebox.net/code/index.php/shared_2009-06-08-23-54-10
ps. I am using NodeBox 1.9.5 on Mac OS X 10.5
I try to find ways to do same effect as var under animation mode. I am wondering if anyone knows how could I integrate with Tkinter smoothly since it provides more controls (ex. Combo) ? or NSObject api calls ?