GTK2, XML, perl
- From: José Luis Regalado <djdaga gmail com>
- To: gtk-perl-list gnome org
- Subject: GTK2, XML, perl
- Date: Sun, 12 Mar 2006 22:04:11 -0400
Greetings Friends.
Sorry by my English this is not very good
I have some doubts.
I chose to use libraries GTK2 and perl.
Everything goes well, but i have to write much code and I not like this.
Now, I am using Glade 2 and this is better because I do not work much
writing code for packing an others.
Glade generate a file called by example: foo.glade. It is possible to
happen of foo.glade to foo.pl?, it is to say, XML to perl code? I using
this script to execute a XML file generated by glade:
use warnings;
use strict;
use Gtk2 -init;
use Gtk2::GladeXML;
my $my_window =
Gtk2::GladeXML->new("/home/bashman/Proyects/window/window.glade");
my $my_window->signal_autoconnect_from_package('main');
my $title = $my_window->get_widget('window');
my $title->set_title('hello'); # here, i can change the window title
and much more.
Gtk2->main;
It is a good one practices to work on the basis of a XML file?
Not if I am mistaken, but I would like to do it thus:
use warnings;
use strict;
use Gtk2 '-init';
use Glib qw/TRUE FALSE/;
#creamos una ventana
my $ventana = Gtk2::Window-> new ('toplevel');
my $boton = Gtk2::Button-> new ('Click Me');
my $txt = Gtk2::Entry::new ('asdsa');
my $labell= Gtk2::Label->new ('Introduzca su nombre');
my $tabla = Gtk2::Table-> new (2, 2, FALSE);
#añadimos el botón a la tabla
$tabla->attach_defaults($labell, 0, 2, 0, 1);
$tabla->attach_defaults($boton, 0, 1, 1, 2);
$tabla->attach_defaults($txt, 1, 2, 1, 2);
$ventana->add($tabla);
$ventana->show_all;
Gtk2->main;
I like see all in perl code without much working, passing of XML to perl.
--
José Luis Regalado
Linux User 280381.
San Cristóbal Edo. Táchira - Venezuela
0276-766.72.20 0276-340.01.90 0414-710.48.57
"Donde hay ignorancia hay fanatismo donde
hay fanatismo no hay tolerancia, donde no hay
tolerancia no hay _paz_"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]