guile bindings to zenity

rain1 ca94f01675 * README.md: Set version to 0.1. пре 8 година
examples b356faca0e * shuffling files around пре 8 година
.gitignore b356faca0e * shuffling files around пре 8 година
LICENSE 6b2d6cf482 Init commit пре 8 година
Makefile 62f735f6df * Makefile: Added a makefile. пре 8 година
README.md ca94f01675 * README.md: Set version to 0.1. пре 8 година
zenity.scm 9fa7b8480d * zenity.scm: fix previous commits. пре 8 година

README.md

guile-zenity

Version: 0.1

Zenity is a command line tool that displays simple dialog boxes.

This library creates scheme procedures that build up a zenity command line, call it then parse the result and return it as scheme data.

https://help.gnome.org/users/zenity/stable/

installation

To use this you need to install the zenity program.

After than you need to move the zenity.scm file of this repo into your GUILE_LOAD_PATH.

To test that it's working try this:

$ guile
scheme@(guile-user)> (use-modules (zenity))
scheme@(guile-user)> (zenity-info "Hello world!")
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
$1 = #t

the warning can be ignored.

examples

There are two examples programs:

  • guile -l birthday.scm: This programs asks your date of birth and sometimes wishes a happy birthday.
  • guile -l list-example.scm: This program demonstrates using the list dialog (since it is a bit more complex to call than others).

functions

Calendar Dialog

(zenity-calendar message)

Shows a calendar for the user to pick a date from. The return value will be #f on Cancel, and an assoc list with fields day, month, year on success.

File Selection Dialog

(zenity-file-selection title #:key (multiple #f) (directory #f) (save #f) (filename #f))

This opens up a dialog for choosing a file. There are keyword options to allow selecting multiple files, restricting it to directories only or making a new filename to save data to. A new keyword filename added to let you preset which directory the file might be chosen from.

Warning: A limitation of the way zenity outputs the file list (separated by the | character) is that this gives bad output on files with | in the name.

List Dialog

(zenity-list message columns rows) (zenity-checklist message columns rows)

Pass in list of columns and then a list of rows to let display and let an item be chosen from a list.

The return value of zenity-list is the selected row. The return value of zenity-checklist is a list of the string versions of the first column of the selected items.

Message Dialog

(zenity-error message) (zenity-info message) (zenity-question message) (zenity-warning message)

Display a simple informational dialog box. The -question and -warning variants return a boolean for whether OK or Cancel was pressed.

Password Dialog, Text Entry Dialog

(zenity-password message) (zenity-entry message)

Asks the user for some input, the return value is #f on Cancel or the text that was inputted.