example-1.pl

来自「Developing with Gnome一书examples例子代码」· PL 代码 · 共 41 行

PL
41
字号
#!/usr/bin/perl -w# This program displays a simple window and has a simple callback for# when the OK button is clicked.use Glib qw(TRUE FALSE);use Gtk2 '-init';    # The '-init' means Gtk2->init gets called initiallyuse Gtk2::GladeXML;# Just to be pedantic...use strict;use vars qw($main_window);sub ok_button_clicked{  my (undef, undef) = @_;  # widget, data are unused  print "Thanks for trying out my program.\n";  Gtk2->main_quit;}# No predefined helper functions exist--all must be manually declared.sub gtk_main_quit{  Gtk2->main_quit;  return TRUE;}  # Init is automatically called  #Gtk2->init;  # load the interface  $main_window = Gtk2::GladeXML->new('example-1.glade');  # connect the signals in the interface; since we didn't declare what  # package we were in, perl defaults to 'main'...  $main_window->signal_autoconnect_from_package('main');  # start the event loop  Gtk2->main;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?