先來Po我寫的範例吧(請自行寫出一個呼叫這個副常式的程式):
sub clicked_me(){
my $msgbox=$main->messageBox(
-message=>"Oh? Hi~",
-title=>"Test",
hechian 發表在 痞客邦 留言(0) 人氣(724)
選項通常都是要以'-'開頭,例如:-text
既然都是以'-'開頭,那我就省略不打囉..
anchor -- 指明資訊如何顯示在widget中。子選項:
n ne e se s sw w nw center background -- 指明當顯示widget時要使用的正常背景顏色 bitmap -- widget中要顯示的點矩陣
boarderwidth -- widget外邊要畫的3D邊界寬度
cursor -- widget要用的滑鼠游標
font -- widget內畫文字所要用的字型
foreground -- widget要用的前景顏色 geometry -- widget視窗所要的幾何 highlightbackground -- widget沒有輸入焦點時在遊走突顯區域所要顯示的顏色 highlightcolor -- widget有輸入焦點時用來遊走繞著widget所畫的突顯矩陣所用的顏色 image -- widget中的影像 insertbackground -- 由插入游標所涵蓋背景所要用的顏色 justify -- 證明顯示widget中的多行文字 orient -- 定位widget的方向,像是捲動軸 padx -- 為widget在X方向請求多少空間
pady -- 為widget在Y方向請求多少空間 relief -- widget所要的3D效果 selectbackground -- 當顯示選取的項目時,要用的背景顏色
text -- 在widget內要顯示的字串 textvariable -- 變數的名稱
troughcolor -- 在widget內矩形槽區域所要用的顏色,像是捲動軸與尺度 underline -- 在widget內要加底線字元的整數索引 xscrollcommand -- 與水平捲動軸通訊的命令
yscrollcommand -- 與垂直捲動軸通訊的命令hechian 發表在 痞客邦 留言(0) 人氣(182)
button -- a button
canvas -- a paint window
checkbutton -- a check button
entry -- a input box
frame -- a simple widget, for a container or spacer, in 複雜的視窗佈局
image -- a widget for show image
label -- a label
listbox -- a list box
menu -- a menu
menubutton -- 一個存取選單的選單按鈕
message -- a message
radiobutton -- a radio button
scrollbar -- a scrollbar
text -- 可編輯的text box
scale -- a scale
hechian 發表在 痞客邦 留言(0) 人氣(210)
事件運算:
bind -- 結合Tcl Script and X events
bindtags -- 結合commands to label
selection -- 將widget放在一個frame中的位置
hechian 發表在 痞客邦 留言(0) 人氣(229)
#!/usr/bin/perl -w
use Tk;
use strict;
my
hechian 發表在 痞客邦 留言(0) 人氣(368)
#!/usr/bin/perl
#宣告使用Tk
use Tk;
#使用嚴謹的語法
use
hechian 發表在 痞客邦 留言(0) 人氣(156)
#!/usr/bin/perl -w
use Tk;
use strict;
my $main=MainWindow->new;
my ($n1,$n2,$add,$eq,$result);
hechian 發表在 痞客邦 留言(0) 人氣(251)