Skip to content
A Python library of basic GUI prompts for macOS computers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit May 28, 2019 Initial commit May 28, 2019
LICENSE Create LICENSE Jun 15, 2019
README.MD Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019 Initial commit May 28, 2019



A Python library of basic GUI prompts for macOS computers. Allows user interraction with utility scripts through simple dialog prompts.

Getting Started

  1. Download this repo:
git clone
cd guilib
  1. Read the help prompt for a dialog script:
/usr/bin/python -h
  1. Run a dialog:
/usr/bin/python --title 'Test Dialog' --prompt 'Hello World!' --button 'OK'

Using the module

In addition to running guilib scripts from the command line, it can be imported for use in your python projects.

  1. Copy the module to your project directory.
  2. Import the module in your script:
#! /usr/bin/python

from guilib import GUIlib
  1. Call a dialog as a module method:
    title='Test Dialog',
    prompt='Hello World!',


Display an error message:

err = "Can't open pod bay doors"
    title='Test Dialog',
    prompt='There was an error: {}'.format(err)

Get the result of two simple choices:

selection = GUIlib.two_button(
    title='Test Dialog',
    prompt='Do you want to play a game?',
if selection == 'Yes':

Get a single line of text:

username = GUIlib.get_singleline(
    title='Test Dialog',
    prompt='What is your name?',

Get text spanning multiple lines:

exampleaddr = '''Cecilia Chapman
711-2880 Nulla St.
Mankato Mississippi 96522
(257) 563-7401'''
address = GUIlib.get_multiline(
    title='Test Dialog',
    prompt='Please confirm your address:',

Get a set of credentials:

creds = GUIlib.get_credentials(
    title='Test Dialog',
    prompt='Please enter your credentials for test server',
r = requests.get('https://testserver.local', auth=(creds['username'],creds['password']))

Get one selection from multiple choices:

choices = ('macOS', 'Windows', 'Linux', 'Other')
best_os = GUIlib.get_listselection(
    title='Test Dialog',
    prompt='Which operating system is best?',
print('{} is the best operating system'.format(best_os))

Select one or more values from a table of data:

data = [
    {'numbers': 1, 'fruit': 'apple', 'pets': 'kitten'},
    {'numbers': 2, 'fruit': 'pear', 'pets': 'puppy'},
    {'numbers': 3, 'fruit': 'pineapple', 'pets': 'turtle'}]
selection = GUIlib.get_tableselection(
    title='Test Dialog',
    prompt='Choose one or more from the list:',


Convert a CSV for tableselect

Use the following example to convert a CSV file with headers for use with tableselect:

import csv
with open('CSVSample.csv') as csvfile:
    data = [{k: v for k, v in row.items()} for row in csv.DictReader(csvfile, skipinitialspace=True)]

selection = GUIlib.get_tableselection('Hello World', 'Select item', data, 'ok', multiple=True)


The macOS builtin system Python /usr/bin/python should be used as nibbler relies on its integration with the PyObjC bridge.

Xcode is required if you would like to modify the existing guilib nib files or create new dialogs of your own.

Known Issues

  • Running scripts from some paths like mounted network shares may result in an "Unable to load nib!" error
  • tableselect search filter only works on string values and does not filter integers


guilib would not be possible without Michael Lynn and their fantastic work on nibbler

You can’t perform that action at this time.