https://github.com/macadmins/nibbler
python pyobjc utility for macOS for displaying dialogs using .nib files
https://github.com/macadmins/nibbler
Last synced: about 1 year ago
JSON representation
python pyobjc utility for macOS for displaying dialogs using .nib files
- Host: GitHub
- URL: https://github.com/macadmins/nibbler
- Owner: macadmins
- License: mit
- Archived: true
- Created: 2016-08-31T14:56:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T15:30:36.000Z (over 3 years ago)
- Last Synced: 2024-02-14T21:26:51.441Z (over 2 years ago)
- Language: Python
- Homepage:
- Size: 47.9 KB
- Stars: 81
- Watchers: 9
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nibbler
Nibbler is officially end of life. Check out the [swiftDialog](https://github.com/bartreardon/swiftDialog) project if you need similar functionality to nibbler.
## Examples
The best way to play with nibbler is to download this git repo and play with the two example files.
1. Download this repo:
```bash
git clone https://github.com/macadmins/nibbler.git
cd nibbler/examples
```
1. Now you can choose between running the `sweet_example.py` and `sam_example.py` scripts.
## Getting Started
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](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) or [Apple Developer Portal](https://developer.apple.com/xcode/download/more/))
Once the requirements above are meet we're able to create our dialog.
1. Launch Xcode.
1. From your menu bar select `File > New > File...`.
1. For the correct template in Xcode 8, select `macOS` and in `User Interface` select `Window`.
1. Click `Next` and you'll be prompted to save your file. Select a name and location.
1. Now we need to get this file into a `.nib` file. From your menu bar select `File > Export...`. Make sure and change your File Format to `Interface Builder Cocoa NIB`.
1. Now you need to write the python code to connect your elements.
## Tips
* 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](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html#//apple_ref/doc/uid/20000957) for the authoritative source on the correct usage of UI elements.
* Consult Apple's [Start Developing iOS Apps (Swift):Build a Basic UI](https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/BuildABasicUI.html) for a tutorial on building a UI in Xcode.