Zenity for Windows



Description
Screenshot
Downloads
Known problems
Building from source
Comments



Warning, the information on this page is severely out of date.
Description:

Zenity is a utility used to add GUI forms to scripts and receive feedback from the user. It was designed for use with Linux and GNOME. It uses GTK+ and GLADE libraries. The official website for Zenity is: http://live.gnome.org/Zenity. I have ported the latest version (2.28.0) of this software to Windows (win32). It should work for both XP and Vista.

Screenshot:

Zenity screenshot


Downloads:

Win32 installer:
 
Source code: http://ftp.gnome.org/pub/gnome/sources/zenity/

Known problems:

1: Help files don't build.

2: When executing from a batch script, the annoying black window belonging to "cmd.exe" stays in the background all the time. I have a written a program, "bg_start", to take care of this http://www.placella.com/software/bg_start/.

3: Even though the "win32-3" version is built with support for LIBNOTIFY, this feature does not really work as it requires a "notification daemon", yet I'm not able to find one that works in windows.

4: The program refuses to install on 64-bit systems. To overcome this, you can right-click on the installer, select properties, then tick the box near "Run this program in compatibility mode". It will work just fine then.

How to build from source:

Warning: this is my personal experience, correct as of October 2009 for Zenity 2.28.0, your results may vary!

First thing required is a build environment consisting of a console, a compiler, as well as, GTK+ and GLADE. I set one up as described here: http://www.gtkforums.com/post-4848.html#4848. I also installed "Strawberry PERL", required by intltool, and added the path to PERL binaries to the "$PATH" environment variable in "/etc/profile". And since "intltool" provided with MINGW was outdated I build one from source code and installed it. After downloading Zenity source code and extracting it it, I went ahead and ran the "configure" script. There were many missing dependencies. Most of these are available as binaries from http://ftp.gnome.org/pub/GNOME/binaries/win32/ and http://gnuwin32.sourceforge.net/packages.html. They can be downloaded as a compressed file and extracted into either your GTK or your mingw directory (as you see fit). There are, however, also a few pesky ones, like "scrollkeeper". As far as I know, there is no way to build it using MINGW and MSYS. To get around this, one can execute the following commands from your bash shell (MSYS) (excluding the dollar signs):
$ echo "int main(){}" > foo.c
$ gcc foo.c -o /bin/scrollkeeper-config
$ rm foo.c
This made the "configure" script happy, but, as far as I can see, it also made impossible to build the help files for Zenity.

After the configure script was happy that all the dependencies were satisfied, Zenity still didn't build and "GCC" was complaining about not being able to find "langinfo.h". Eventually I found it in the form of the "libgw32c" library from http://gnuwin32.sourceforge.net/packages.html. I extracted the archive in "/mingw". To make the system aware of this library and resolve a conflict, the following commands need to be issued in MSYS (modify the path to libgw32c to match it's location on your PC):
$ export CFLAGS="-I/mingw/include/glibc -DMINGW_BUILD"
$ export LIBS="-lgw32c"
$ mv /mingw/include/glibc/stdlib.h /mingw/include/glibc/stdlib.h.bak
At this point it is necessary to run "./configure" again to enable "LC_MESSAGES". This should fulfill all requirements and Zenity should build. It will, however, not work. Paths to external files are hard coded into the executable at compile time. For Linux this is perfectly fine as the files within the operating system are very well organised, for Windows this does not work. My solution to this was to modify the source code and get Zenity to check an environment variable (which can be set at install time) to get a path to external files. You can download my patch here: zenity-2.28.0_win32-3.patch It can be applied from inside Zenity's root folder (where the configure script is and where you should have saved the patch) with the following command:
$ patch -p0 < zenity-2.28.0_win32-3.patch
And now Zenity can be built:
$ make
After you export the environment variable "ZENITY_DATADIR" and assign it a value corresponding to the directory containing "zenity.ui" and the pictures from the "data" directory, the program should actually run, too!

I'm not going to explain how the program should be packaged for it to work correctly, if you need to know this I suggest you download the installer and have a look around. Also, you can look at my NSIS script here: zenity-2.28.0_win32-3.nsi


Comments:

Comments to date: 23. Page 1 of 1. Average Rating:

ema   Argentina

4:19pm, March 31st, 2013 

Thanking you since 2009!!!

Willi   Leipzig Germany

5:08am, February 25th, 2013

EDIT
the backslashes in my previous comment are missing:
I had to removed the trailing backslash in the path added to windows xp's path environmental variable (...zenity bslash bin bslash to ...zenity bslash bin)
@ jack: works for me under octave 3.6.2 with MinGW and zenity package from sourceforge 0.5.7

Willi   Leipzig Germany

4:52am, February 25th, 2013 

I'm running it successfully on a Win XP within a virtual Machine on my Ubuntu (for testing and porting programms). Great work!
Installation works easy, but I had to change the (automatically added) path from ...zenitiybin to ...zenitybin. Not sure if that's a bug of my machine or the installation routine.
(@ jack, france: works for me within octave 3.6.2 MinGW and zenity 0.5.7 package.)

Lucio   Italy

1:10am, February 17th, 2013 

Hi, very nice one i use it a lot under Linux, and now i would like to try it under windows, but i get one error:
** (zenity.exe:5160): WARNING **: Could not load ui file (null)datazenity.ui: Failed to open file '(null)datazenity
.ui': No such file or directory
Seems like that under the installer some file does not been writed.
Very nice work thank you!

Admin:  Hi Lucio, that error means that the installer did not set the ZENITY_DATADIR environment variable, it should point to the "data" folder inside the folder where you installed zenity. Not sure why, perhaps running the installer in compatibility mode with WinXp might have helpped. Anyway, here's how to do it: http://www.itechtalk.com/thread3595.html. Bye

Wolf-Dieter Groll   Germany

5:30am, September 24th, 2012 

I like Zenity very much on Linux (5 - Excellent), but the Windows Version wiped out the whole system PATH variable during installation!
So keep your fingers off, or at least save your PATH before installing Zenity and restore it afterwards.
I haven't done so, thus now I have to repair my system...

Regards
Wolf-Dieter

Brian Snipes   United States

4:01pm, March 13th, 2012 

Snarl for Windows works for notifications - http://snarl.fullphat.net/

iGore   Germany

10:03am, March 10th, 2012 

Hi. I have a problem with the progress-bar in Zenity for Windows. I'm writing a PHP-script for the cmd and i want that the progress-bar is moving from 0% to 100% in a certain time. Quasi as a sleep function with the possebility to cancel the progress-bar.

In tutorials I found this code:

$foo = system('echo "25"; sleep 1 echo "# Message 1" echo "50"; sleep 1 echo "# Message 2" echo "100") | zenity --progress --text "In progress" --percentage=0');

This code open the progress-bar but directly with 100%.
So my question is: How to use the progress-bar in the cmd of Windows 7 correct?

T... read more »

Jeremy   USA

1:20am, February 25th, 2012 

Hi i have a problem is that I want to enter in a graphical user and password, so anyone can use this option and not root, then I have not found a way to say that zenity accept me and I run a user
/ usr / bin / firefox https://addons.mozilla.org/, unless I do it manually by editing the script (do not want that) I need to invoke this instruction without root privileges given by the script 1st to 2 having the menu (firefox addons) because addons are not useful in the root. Sorry my English is bad.

elif ["$ option" = "Firefox addons"]
Then
zenity - hide-text - entry - title = "enter your pa... read more »

Novato   España

10:40pm, February 9th, 2012 

Hi, I'm starting to use zenity for the first time, I think fantastoco but not how to make a variable, for example in Linux is as simple as this:

var = $ (zenity - entry)

But if I put it in a. Bat for example I get this instead:

"var" is not recognized as an internal or external command, program or batch file.

It is probably silly but I am a newbie, hope can help.

Google Translator


hola, estoy empezando a usar zenity por primera vez, me parece fantastoco pero no se como hacer una variable, por ejemplo en linux es tan simple como esto:

var=$(zenity --entry)

Pero si pong... read more »

Admin:  Hi Novato, There are some sample usage files in the "examples" folder, which can be found in the folder where you installed zenity. That said, I don't know how to set variables to the value returned by zenity directly. Instead I output the value to a file and then read it into a variable (there probably is a better way though). Example:

@echo off
zenity --calendar > "%~d0%~p0\zenity.tmp"
set /p OUTPUT= < "%~d0%~p0\zenity.tmp"
del "%~d0%~p0\zenity.tmp"
zenity --info --text="You entered: %OUTPUT%"

Joel   Tijuana, México

12:31am, September 14th, 2011 

Good, how about a lite version for those who already have gtk2 installed :)?

Good job

Admin:  Well, the chances that one will have exactly the correct version of gtk+ installed are fairly slim, so no...

iGore   Ger

9:41am, July 18th, 2011 

Hi. I'm trying to write a simple php script, that i run in the cmd of Windows 7(64). My problem is that i dont get back the return value of the pushed button, only the return value of the entry.

$msg = "this is my message";
$rv = shell_exec('zenity --entry --title "Entry" --text "'.$msg.'"');
echo $rv;

How do i get the return values of the pushed button?

thx in advance,
iGore

Admin:  So you want to know if the user pressed 'OK' or 'Cancel'. Well, you are using the wrong PHP function call for that. You should, in fact, be using 'system()'. Here's an example:

<?php
  $msg = "this is my message";
  ob_start();
  $retval = 0;
  $string = system('zenity --entry --title "Entry" --text "'.$msg.'"', $retval);
  ob_end_clean();
  echo $string . "\n" . $retval;
?>

Sundi   US

7:48pm, May 15th, 2011 

Does anyone know if I can use the "--no-cancel" command with this version of Zenity to hide the cancel button with the progress bar

Benjamin   California

12:27am, April 30th, 2011 

Thank you so much for porting Zenity to Windows! This made it really easy to get my bash scripts to work in both Linux and Windows! This really helped a lot.

Luciano Seibel   Brazil, Sapiranga

8:36am, March 11th, 2011 

Great!!! For win32 but on my WIN7 64 bits doesnt install ...

Admin:  To use in 64-bit Windows 7 you can right-click on the installer, select properties, then tick the box near "Run this program in compatibility mode". It will work just fine then. Hope this helps.

Shantanu Kumar   Bangalore, India

1:37am, March 1st, 2011 

Zenity for Windows is an excellent tool, but it wiped out my PATH variable on 32-bit Windows 7 and replaced it with its own when I installed it. Hence rating it as dreadful. :-(

KIAaze   Location unknown

1:05pm, February 23rd, 2011

The environment variable ZENITY_DATADIR is incorrectly defined by the installer.

Dony   Brazil

4:35pm, January 10th, 2011 

Excelent job man!
Thanks, i was searching something like this!

Don't stop!

TheCric   France

11:30am, November 13th, 2010 

Very useful on Windows - Great job - Thanks a lot

Agnus   Brazil

2:19pm, July 21st, 2010 

Thanks a lot!
Great Job!

Thx
Regards

Hans   Austria

1:38am, April 19th, 2010 

Fine tool, this makes life for scripters much easier.

Jack   France

5:07pm, January 29th, 2010 

I am trying to run it with a portable version of Octave. How to make zenity on win portable.

Admin:  Sorry man, I don't even know what Octave is...

Eric HAMON   Gretz, FRANCE

3:38am, December 29th, 2009 

Excellent. It's very easy to make it portable too.
Thx
Regards

steve   Hungary

4:44am, November 30th, 2009 

Thanks a lot! :)
Great tool, i missed it from win...

Comments have now been disabled. Apologies for any inconvenience.



This page was last updated: 8/Nov/2009