PracticeDev/study_perl/gtk3_webkit2/test_webkit2.pl

23 lines
502 B
Perl

use Gtk3 -init;
use Gtk3::WebKit2;
my ($url) = shift @ARGV || 'https://www.frytea.com/';
my $window = Gtk3::Window->new('toplevel');
$window->set_default_size(800, 600);
$window->signal_connect(destroy => sub { Gtk3->main_quit() });
# Create a WebKit2 widget
my $view = Gtk3::WebKit2::WebView->new();
# Load a page
$view->load_uri($url);
# Pack the widgets together
my $scrolls = Gtk3::ScrolledWindow->new();
$scrolls->add($view);
$window->add($scrolls);
$window->show_all();
Gtk3->main();