Hai
Hai

Reputation: 4886

Shell Script with Zenity

Using Zenity is possible to add buttons,change fonts ,anything besides default options? If not,there's another dialog for sh that allows more customizing?

Upvotes: 1

Views: 4440

Answers (4)

Ikem Krueger
Ikem Krueger

Reputation: 193

You can use gtkdialog with glade:

gtkdialog --glade-xml=file.glade --program=MAIN_WINDOW

Upvotes: 0

Mansab Uppal
Mansab Uppal

Reputation: 653

Please make sure that you have correct 'PyZenity' installed for the version of Python you are using.

Here's a link to download pyzenity-0.1.4: Download pyzenity-0.1.4

This has been working fine for Python 2.6

Also, I have Python 2.7 installed over one of my other machines, but that gives the same error there.

So, to resolve this (for later versions of Python), use Active Python and then use 'pym' to install Pyzenity for the same.

Upvotes: 0

ephemient
ephemient

Reputation: 204768

Zenity supports a few HTML-like tags for text markup: <b>, <i>, <u>, <s>, <tt>, <big>, <small>, and more -- well, really it's Gtk+ that supports those tags, but Zenity gets to piggyback on top of those features.

For more control over your dialogs, you can intead use Kommander. It's like a form builder compatible with all sorts of scripting languages: Python, Perl, Ruby, shell. There's various examples out there.

Upvotes: 3

Chas. Owens
Chas. Owens

Reputation: 64929

You can probably change the style with the ~/.gtkrc file, but that can be painful. You might want to just move on up to writing real GUI programs with Gtk2-Perl:

#!/usr/bin/perl

use strict;
use warnings;
use Gtk2;

Gtk2->init;

my $window = Gtk2::Window->new;
my $vbox   = Gtk2::VBox->new;
my $label  = Gtk2::Label->new("Hello World");
my $button = Gtk2::Button->new("Press me");

$window->add($vbox);
$vbox->add($label);
$vbox->add($button);

$window->set_default_size(200, 200);
$window->signal_connect(
    destroy => sub {
        Gtk2->main_quit;
    }
);

my $i = 0;
$button->signal_connect(
    clicked => sub {
        $label->set_text("button pressed " . ++$i . " times");
    }
);

$window->show_all;

Gtk2->main;

Upvotes: 0

Related Questions