Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- # Instalar Gtk3 y Gtk3::WebKit por CPAN,para funcionar correctamente
- # Programa de prueba para Tiempo de Tux <http://www.itimetux.com>
- # Por Demianx864
- # Eres libre de modificar el programa
- # Simple PerlBrowser
- use Gtk3 -init;
- use Gtk3::WebKit;
- system("clear");
- # Definimos Url desde consola
- print "Simple Perl Browser\n";
- print "Teclea una url: ";
- my $url = <STDIN>;
- chop($url);
- $pagina = shift @ARGV || $url;
- my $sbr = substr($pagina,0,7);
- # Checamos si tiene http y si no es así cambiamos el valor
- if ($sbr eq "http://") {
- $pagina = $pagina;
- }
- else{
- $pagina = "http://$pagina";
- }
- # Parámetros de la ventana
- my $ventana = Gtk3::Window->new('toplevel');
- $ventana->set_default_size(800, 600);
- $ventana->set_title("Simple PerlBrowser");
- $ventana->signal_connect(destroy => sub { Gtk3->main_quit() });
- # Llamamos Webkit
- my $ver = Gtk3::WebKit::WebView->new();
- # Cargamos url
- $ver->load_uri($pagina);
- # Unimos todo
- my $scrolls = Gtk3::ScrolledWindow->new();
- $scrolls->add($ver);
- $ventana->add($scrolls);
- # Lo mostramos
- $ventana->show_all();
- Gtk3->main();
Advertisement
Add Comment
Please, Sign In to add comment