Nibbler is officially end of life. Check out the swiftDialog project if you need similar functionality to nibbler.
The best way to play with nibbler is to download this git repo and play with the two example files.
-
Download this repo:
git clone https://github.com/macadmins/nibbler.git cd nibbler/examples
-
Now you can choose between running the
sweet_example.py
andsam_example.py
scripts.
Now that you've seen what nibbler does from the examples you'll likely want to build your own dialog box. To get started you'll need:
- A Mac with Python (fortunately all modern Macs come with this built-in)
- The PyObjC bridge (again comes built-in)
- Xcode (available from the MAS or Apple Developer Portal)
Once the requirements above are meet we're able to create our dialog.
- Launch Xcode.
- From your menu bar select
File > New > File...
. - For the correct template in Xcode 8, select
macOS
and inUser Interface
selectWindow
. - Click
Next
and you'll be prompted to save your file. Select a name and location. - Now we need to get this file into a
.nib
file. From your menu bar selectFile > Export...
. Make sure and change your File Format toInterface Builder Cocoa NIB
. - Now you need to write the python code to connect your elements.
- Make sure and give all of your UI elements in Xcode a static identifier. Xcode by default sets identifiers to
Automatic
however that does not work with nibbler. - Printing your content handles is very helpful:
print n.nib_contents
- Printing your views can also help with troubleshooting:
print n.views
- Consult Apple's macOS Human Interface Guidelines for the authoritative source on the correct usage of UI elements.
- Consult Apple's Start Developing iOS Apps (Swift):Build a Basic UI for a tutorial on building a UI in Xcode.