
Tk / TTKウィジェットと組み合わせたTclスクリプト言語の強力な機能により、この環境で本格的なアプリケーションを作成できます。 これは、そのクロスプラットフォームとC / C ++プログラミング言語との優れた統合によっても促進されます。
また、例として、Cのプログラムの例をすぐに示します。このプログラムは、行を入力するフィールド、クリックするとボタン、行の長さが計算され、結果を表示するフィールドを備えたグラフィカルインターフェイスを構築します。
Cプログラムのテキストは次のとおりです。
#include <stdlib.h> #include <stdio.h> #include <tcl.h> #include <tk.h> #include <string.h> Tcl_Interp * tcl_interp ; int lenStr(){ int code; int len; char slen[256]; char *res; /* widget- tcl a*/ code = Tcl_Eval(tcl_interp, "set a [.ent1 get];"); /* tcl- a res :*/ res = (char *)Tcl_GetVar(tcl_interp, "a", TCL_APPEND_VALUE); /* C :*/ len = strlen(res); /* */ slen[0] = '\0'; sprintf(slen, "%i", len); /* slen Tcl- lens:*/ Tcl_SetVar(tcl_interp, "lens", slen, TCL_GLOBAL_ONLY); /* , */ code = Tcl_Eval(tcl_interp, ".ent4 delete 0 end;"); /* */ code = Tcl_Eval(tcl_interp, ".ent4 insert 0 $lens;"); /* */ return TCL_OK; } int main (int argc, char *argv[]) { /*Tcl/Tk - */ char strtcl[] ="\ wm title . \" C Tcl/Tk\";\ label .lab0 -text {strlen(};\ pack .lab0 -anchor {center} -side {left};\ entry .ent1 ;\ pack .ent1 -anchor {center} -side {left};\ label .lab2 -text {)};\ pack .lab2 -anchor {center} -side {left};\ button .but3 -text {=} -command {lenstr};\ pack .but3 -anchor {center} -side {left};\ entry .ent4 -width {5};\ pack .ent4 -pady {4} -side {top};\ pack .lab0 .ent1 .lab2 .but3 .ent4 -in {.};\ .ent4 delete 0 end;\ "; int code; Tcl_FindExecutable(argv[0]); /* tcl-*/ tcl_interp = Tcl_CreateInterp(); /* tcl-*/ Tcl_Init(tcl_interp); /* Tk- tcl-*/ Tk_Init(tcl_interp); /* Tcl/Tk */ code = Tcl_Eval(tcl_interp, strtcl); /* Tcl/Tk : code = Tcl_EvalFile(tcl_interp, filetcl); */ /* lenstr */ code = Tcl_Eval(tcl_interp, ".but3 configure -command lenstr;"); /* "lenstr" lenStr C-*/ Tcl_CreateCommand(tcl_interp, "lenstr", (Tcl_CmdProc *)lenStr, NULL, NULL); /* */ Tk_MainLoop(); return 0; }
コードに追加のコメントは必要ないと思います。 次のようにして実行可能コードを取得できます。
$gcc -o test_c test_c.c -ltcl8.6 -ltk8.6 $
複雑なGUIを使用してアプリケーションを作成する場合は、デザイナーを使用して設計することをお勧めします。 Vtcl、TKproE-2.20などの両方を使用できます。 TKproEの使用をお勧めします。 保存したプロジェクトから、TKopenWindowプロシージャの本体を取得し、Tcl_EvalまたはTcl_EvalFile関数を使用してロードするだけで十分です。 前者の場合、コードはプログラム本体に挿入され、たとえば、例のようにstrtcl変数に割り当てられます。 2番目の場合、ファイルに保存され、そこからロードされます。
自然な質問は、ボタンをクリックするなどのイベントの処理方法です。 この場合、ロードされたtclコード(たとえば、ボタンウィジェットの-commandオプション)の関数名と、プログラムコードの関数との対応が設定されます。 この例では、これは次の行です。
Tcl_CreateCommand(tcl_interp, "lenstr", (Tcl_CmdProc *)lenStr, NULL, NULL);
tclインタープリターとメインCプログラムの間でデータを交換するには、関数Tcl_GetVarおよびTcl_SetVar(例を参照)、Tcl_LinkVarなどを使用できます。
C ++でTkウィジェットを使用してGUIアプリケーションを開発するために、美しい
CPPTKライブラリが
開発さ
れました 。 その最後の
更新は 、今年の5月
にリリースされました。 ただし、最後から2番目のバージョン、つまりCPPTK-1.0.2に留意してください。
このライブラリを開発に使用すると、グラフィックアプリケーションを開発するために、libtclライブラリとlibtkライブラリのインターフェースを忘れることができます(上記を参照)。 CPPTKライブラリのインターフェースがTcl / Tkインターフェースに可能な限り近く、最も重要なことは十分に文書化されていることを考えると、これはたくさんあります。

そのため、CPPTKライブラリを使用すると、クラシックtkウィジェットでGUIアプリケーションを開発できます。 しかし、非常によく設計されているため、テーマウィジェットttkのサポートを追加しても切り替えは困難ではありません。
CPPTK-1.0.2ライブラリのパッチはこちら diff -ruN cpptk-1.0.2/base/cpptkbase.cc cpptk-1.0.2_with_ttk/base/cpptkbase.cc --- cpptk-1.0.2/base/cpptkbase.cc 2017-12-12 09:58:00.269337115 +0300 +++ cpptk-1.0.2_with_ttk/base/cpptkbase.cc 2017-12-08 14:41:51.589205618 +0300 @@ -209,11 +209,16 @@ // refresh Tcl variables linkCpptoTcl(); } - catch (exception const &e) + +/*XXXXX*/ +// catch (exception const &e) + catch (std::exception const &e) + { Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE); return TCL_ERROR; } + return TCL_OK; } diff -ruN cpptk-1.0.2/cpptk.cc cpptk-1.0.2_with_ttk/cpptk.cc --- cpptk-1.0.2/cpptk.cc 2017-12-12 09:58:00.268337115 +0300 +++ cpptk-1.0.2_with_ttk/cpptk.cc 2017-12-11 20:10:09.699863718 +0300 @@ -226,6 +226,28 @@ return Expr(str); } +/*XXXXX*/ +Expr Tk::addtab(string const &w1, + string const &w2) +{ + string str(""); + str += w1; + str += " add "; + str += w2; + str += " "; + return Expr(str); +} +Expr Tk::tab(string const &w1, + string const &w2) +{ + string str(""); + str += w1; + str += " tab "; + str += w2; + str += " "; + return Expr(str); +} + Expr Tk::panedwindow(string const &name) { @@ -254,6 +276,20 @@ str += name; return Expr(str); } + +/*XXXXX*/ +Expr Tk::combobox(string const &name) +{ + string str("ttk::combobox "); + str += name; + return Expr(str); +} +Expr Tk::notebook(string const &name) +{ + string str("ttk::notebook "); + str += name; + return Expr(str); +} Expr Tk::textw(string const &name) { diff -ruN cpptk-1.0.2/cpptkconstants.x cpptk-1.0.2_with_ttk/cpptkconstants.x --- cpptk-1.0.2/cpptkconstants.x 2017-12-12 09:58:00.269337115 +0300 +++ cpptk-1.0.2_with_ttk/cpptkconstants.x 2017-12-08 17:51:55.772314308 +0300 @@ -81,6 +81,9 @@ CPPTK_CONSTANT(hourglass) CPPTK_CONSTANT(horizontal) CPPTK_CONSTANT(iconbitmap) +//XXXXX +CPPTK_CONSTANT(iconphoto) + CPPTK_CONSTANT(iconic) CPPTK_CONSTANT(iconify) CPPTK_CONSTANT(iconmask) diff -ruN cpptk-1.0.2/cpptk.h cpptk-1.0.2_with_ttk/cpptk.h --- cpptk-1.0.2/cpptk.h 2017-12-12 09:58:00.268337115 +0300 +++ cpptk-1.0.2_with_ttk/cpptk.h 2017-12-08 14:43:29.004206546 +0300 @@ -74,6 +74,12 @@ std::string const &w8 = std::string(), std::string const &w9 = std::string(), std::string const &w10 = std::string()); +/*XXXXX*/ +details::Expr addtab(std::string const &w1, + std::string const &w2 = std::string()); +details::Expr tab(std::string const &w1, + std::string const &w2 = std::string()); + template <typename T\> details::Expr pack(std::string const &option, @@ -85,6 +91,27 @@ str += details::toString(t); return details::Expr(str); } +/*XXXXX*/ +template <typename T\> +details::Expr addtab(std::string const &option, + std::string const &w, T const &t) +{ + std::string str("addtab "); + str += option; str += " "; + str += w; str += " "; + str += details::toString(t); + return details::Expr(str); +} +template <typename T\> +details::Expr tab(std::string const &option, + std::string const &w, T const &t) +{ + std::string str("tab "); + str += option; str += " "; + str += w; str += " "; + str += details::toString(t); + return details::Expr(str); +} details::Expr panedwindow(std::string const &name); @@ -93,6 +120,9 @@ details::Expr scrollbar(std::string const &name); details::Expr spinbox(std::string const &name); +/*XXXXX*/ +details::Expr combobox(std::string const &name); +details::Expr notebook(std::string const &name); details::Expr textw(std::string const &name); diff -ruN cpptk-1.0.2/cpptkoptions.x cpptk-1.0.2_with_ttk/cpptkoptions.x --- cpptk-1.0.2/cpptkoptions.x 2017-12-12 09:58:00.269337115 +0300 +++ cpptk-1.0.2_with_ttk/cpptkoptions.x 2017-12-08 18:05:51.108322269 +0300 @@ -49,6 +49,9 @@ CPPTK_OPTION(columnspan, false) CPPTK_OPTION(compositingrule, false) CPPTK_OPTION(compound, false) +//XXXXX +CPPTK_OPTION(padding, false) + CPPTK_OPTION(confine, false) CPPTK_OPTION(container, false) CPPTK_OPTION(cursor, false) @@ -76,6 +79,9 @@ CPPTK_OPTION(fg, false) CPPTK_OPTION(fgstipple, false) CPPTK_OPTION(file, true) +//XXXXX +CPPTK_OPTION(data, true) + CPPTK_OPTION(fill, false) CPPTK_OPTION(font, false) // TODO: fontmap option of the canvas postscript command
このパッチは、新しいウィジェットのサポートだけでなく、画像を操作する際の–dataモードのサポートも追加します(images(create、photo、 '' myimage '' –date( '' PEM / base64 data '');)。残念ながら、スポイラーに置くとき、行+テンプレートを+テンプレート<typename T \>に置き換える必要がありました(そうでなければ、スポイラーはテキストを正しく表示しませんでした)。
次のようにパッチを適用します。 ディレクトリを作成します。 CPPTKプロジェクトディレクトリをその中に配置します。 その中に、たとえばpatchForCPPTK-1.0.2.patchファイルにスポイラーからのパッチを保存し(コメントを考慮して)、このディレクトリにいる間にパッチを適用します。
$patch –p0 < patchForCPPTK-1.0.2.patch $
これで、新しいウィジェットをサポートするCPPTKライブラリができました。 それでも、GUIを手動で記述することは恩知らずの問題です。
TKproEデザイナーを使用してGUI
自体を設計することは、依然として便利です。 既製のtclスクリプトからCPPTKライブラリを使用してC ++プログラムを取得するには、単純なtclスクリプトconvertFromTclToCPPTK.tclを開発します。
tclスクリプトconvertFromTclToCPPTK.tcl #!/usr/bin/tclsh # 1 -- source file from tkproe #Soft ## Procedure: parseConfig proc ::parseConfig {w data cfile} { set ldata $data set len [llength $ldata] #puts $len set two "" set tree "" set first [lindex $ldata 0] if { $len \> 1 } { set two [lindex $ldata 1] } if { $len \> 2 } { set tree [lindex $ldata 2] } if {$first == "wm"} { set wmstr "wm($two" for {set i 2} {$i < $len} {incr i} { set par [lindex $ldata $i] set a ", \"$par\"" set wmstr "$wmstr$a" } set a ");" set wmstr "$wmstr$a" puts "\t$wmstr" return } # widget tk set tkWid "frame canvas button entry label message listbox text menubutton menu scrollbar scale checkbutton radiobutton toplevel labelframe spinbox panedwindow" set ttkWid "ttk::notebook ttk::combobox" set beg [string first $first $tkWid] if { $beg != -1 } { set initI 2 set wmstr "\t$first (\"$two\"" # set wmstr "$first(\"$two\"" if { [string range $tree 0 0 ] != "-" } { set wmstr "$wmstr, \"$tree\"" incr initI } set wmstr "$wmstr) " set lenstr [string length $wmstr] for {set i $initI} {$i < $len} {incr i} { set par [lindex $ldata $i] incr i set parVal [lindex $ldata $i] if { $par == "-variable" || $par == "-textvariable"} { set wmstr "$wmstr $par ($parVal)" } else { set wmstr "$wmstr $par (\"$parVal\")" } incr lenstr [string length $par] incr lenstr [string length $parVal] if {$lenstr \> 70} { set wmstr "$wmstr\n\t\t" set lenstr 10 } } set wmstr "$wmstr;" puts $wmstr return } #addTab to notebook set beg [string first " add ." $data] if { $beg != -1 } { set initI 2 set wmstr "\taddtab (\"$first\"" # set wmstr "$first(\"$two\"" if { [string range $tree 0 0 ] != "-" } { set wmstr "$wmstr, \"$tree\"" incr initI } set wmstr "$wmstr) " for {set i $initI} {$i < $len} {incr i} { set par [lindex $ldata $i] incr i if { $par == "-image" } {continue} set parVal [lindex $ldata $i] if { $par == "-variable" || $par == "-textvariable"} { set wmstr "$wmstr $par ($parVal)" } else { set wmstr "$wmstr $par (\"$parVal\")" } } set wmstr "$wmstr;" puts $wmstr return } #ttk::notebook set beg [string first "ttk::notebook" $data] if { $beg != -1 } { set initI 2 set wmstr "\tnotebook (\"$two\"" # set wmstr "$first(\"$two\"" if { [string range $tree 0 0 ] != "-" } { set wmstr "$wmstr, \"$tree\"" incr initI } set wmstr "$wmstr) " for {set i $initI} {$i < $len} {incr i} { set par [lindex $ldata $i] incr i # if { $par == "-image" } {continue} if { $par == "-variable" } {continue} if { $par == "-textvariable" } {continue} if { $par == "-takefocus" } {continue} set parVal [lindex $ldata $i] set wmstr "$wmstr $par (\"$parVal\")" } set wmstr "$wmstr;" puts $wmstr return } #ttk::combobox set beg [string first "ttk::combobox" $data] if { $beg != -1 } { set initI 2 set wmstr "\tcombobox (\"$two\"" # set wmstr "$first(\"$two\"" if { [string range $tree 0 0 ] != "-" } { set wmstr "$wmstr, \"$tree\"" incr initI } set wmstr "$wmstr) " for {set i $initI} {$i < $len} {incr i} { set par [lindex $ldata $i] incr i # if { $par == "-variable" } {continue} # if { $par == "-textvariable" } {continue} if { $par == "-takefocus" } {continue} # if { $par == "-relwidth" } {continue} set parVal [lindex $ldata $i] if { $par == "-variable" || $par == "-textvariable"} { set wmstr "$wmstr $par ($parVal)" } else { set wmstr "$wmstr $par (\"$parVal\")" } } set wmstr "$wmstr;" puts $wmstr return } #tkPlace set tkPlace "tkPlace: pack place grid" set beg [string first $first $tkPlace] if { $beg != -1 } { set tire 0 set initI 2 set wmstr "\t$first (\"$two\"" set lenstr [string length $wmstr] for {set i $initI} {$i < $len} {incr i} { set par [lindex $ldata $i] if { [string range $par 0 0 ] != "-" } { set wmstr "$wmstr, \"$par\"" continue } else { if { $tire == 0} { incr tire set wmstr "$wmstr) " } } if {$tire == 1} { incr i } if { $par == "-variable" } {continue} if { $par == "-textvariable" } {continue} if { $par == "-relwidth" } {continue} if { $par == "-fill" && $first == "pack" } {continue} set parVal [lindex $ldata $i] if {$parVal == ".\}"} { set parVal "." } set wmstr "$wmstr $par (\"$parVal\")" incr lenstr [string length $par] incr lenstr [string length $parVal] if {$lenstr \> 70} { set wmstr "$wmstr\n\t\t" set lenstr 10 } } set wmstr "$wmstr;" puts $wmstr return } if {$two == "configure"} { set wmstr "\t\"$first\" << configure() " for {set i 2} {$i < $len} {incr i} { set par [lindex $ldata $i] incr i set parVal [lindex $ldata $i] set wmstr "$wmstr $par (\"$parVal\")" } set wmstr "$wmstr;" puts $wmstr return } return } set largv [llength $argv] if {$largv != 1} { puts "Usage: [info script] <file tcl from TKproE\>\n" exit } set fconf [file exists "$argv"] if { $fconf == "0" } { puts "File=\"$argv\" don't exist\n" puts "Usage: [info script] <file tcl from Page\>\n" exit } set file $argv proc findFile {} { set types { {"GUI " {*.tcl} } {" " *} } set file "" set homeDir $env(HOME) set file [tk_getOpenFile -filetypes $types -parent . -initialdir $homeDir] puts "You selected file \"$file\"" if {[string compare $file ""] == 0} { return "" } } # read the file one line at a time set fp [open $file r] fconfigure $fp -buffering line puts "//Get file tcl from=$file" #"proc TPopenWindow" #"proc TPcloseWindow" set parseStr 0 puts "#include \"cpptk.h\"" puts "#include <iostream\>\n" puts "using namespace Tk;" puts "using namespace std;\n" puts "int main(int, char *argv\[\])\n\{\n try\n {\n\tinit(argv\[0\]);" while 1 { gets $fp data if [eof $fp] break if {$data == ""} continue set com [string range $data 0 0] if {$com == "\n" || $com == "#"} continue set data [string trim $data] set len [string first "proc TPopenWindow" $data 0] if {$len != -1 } { set parseStr 1 puts "/*$data\}*/" continue } set len [string first "proc TPcloseWindow" $data 0] if {$len != -1 } { set parseStr 0 puts "/*$data\}*/\n" continue } if { $parseStr == 0 } {continue} parseConfig . $data $file } puts "\trunEventLoop();\n }\n catch (exception const &e)\n {\n\tcerr << \"Error: \" << e.what() << '\\n';\n \}\n\}" close $fp exit
C ++プログラムを取得するには、次のスクリプトを実行するだけです。
$ convertFromTclToCPPTK.tcl <tcl- TKproE> > < C++ - > $
例として、SAP AG製品で使用されるSSFライブラリ(「Secure Store and Forward」)を使用した高度な電子署名生成プログラムの開発を検討してください。ロシアの暗号アルゴリズム(GOST 28147- 89、GOST R 34.11-94、GOST R 34.11-2012、GOST R 34.10-2001、GOST R 34.10-2012)。 TKproEデザイナーのGUIプロジェクトは次のとおりです。

このプロジェクトのスクリプトはこちらです。 # Generated by TKproE 2.20 - Tue Dec 12 12:50:32 MSK 2017 encoding system utf-8 global myHOME set myHOME $env(HOME) # Load all images # Define named fonts # Global variable initialization proc TPinitVars {} { # Initialize global variables namespace eval :: {;#Creating namespace ::;} set {::selectedButton} {} array set {::vTcl} {} set ::TPexclusions(user_namespace) {} set ::TPprojType TCL_TK } # Toplevel window procedures proc TPopenWindow. {} { # CLONEPATH = . # Cloned Tue Dec 12 12:50:32 MSK 2017 . configure -background {#00F5FF} bindtags . {. Tkproe.tcl all} wm aspect . wm focusmodel . passive wm grid . wm geometry . 723x618+383+57 wm iconmask . wm iconposition . wm maxsize . 1585 870 wm minsize . 1 1 wm overrideredirect . 0 wm positionfrom . user wm resizable . 1 1 wm sizefrom . wm state . normal wm transient . labelframe .lfSSF -borderwidth {4} -foreground {#141312} -relief {ridge} -text { SSF} -background {#FFDEAD} -height {100} -padx {4} -width {100} entry .lfSSF.entSSF -background {#FFFAFA} -foreground {#141312} -highlightbackground {#ffffff} -highlightcolor {#141312} -selectbackground {#418bd4} -selectforeground {#ffffff} -width {40} pack .lfSSF.entSSF -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left button .lfSSF.butSSF -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text { } pack .lfSSF.butSSF -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 9 -pady 0 -side right pack .lfSSF -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top pack .lfSSF.entSSF .lfSSF.butSSF -in .lfSSF ttk::notebook .nbSSF -width {700} -height {400} -padding {7} .nbSSF state {} frame .nbSSF.frameNB1 -borderwidth {4} -relief {sunken} -background {#FF7256} -height {30} -highlightbackground {#e0dfde} -highlightcolor {#141312} -width {30} label .nbSSF.frameNB1.labLogo -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -height {329} -highlightbackground {#e0dfde} -highlightcolor {#141312} -relief {raised} -text {labLogo} -width {509} pack .nbSSF.frameNB1.labLogo -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 28 -side top pack .nbSSF.frameNB1.labLogo -in .nbSSF.frameNB1 frame .nbSSF.frameNB2 -borderwidth {2} -relief {raised} -background {#FF4500} -height {30} -highlightbackground {#e0dfde} -highlightcolor {#141312} -pady {19} -width {30} labelframe .nbSSF.frameNB2.lfSignDoc -borderwidth {4} -foreground {#141312} -relief {ridge} -text { } -background {#e0dfde} -height {100} -width {100} entry .nbSSF.frameNB2.lfSignDoc.entSignDoc -background {#FFFAFA} -foreground {#141312} -highlightbackground {#ffffff} -highlightcolor {#141312} -selectbackground {#418bd4} -selectforeground {#ffffff} -width {40} pack .nbSSF.frameNB2.lfSignDoc.entSignDoc -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side left button .nbSSF.frameNB2.lfSignDoc.butSignDoc -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text {} pack .nbSSF.frameNB2.lfSignDoc.butSignDoc -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 6 -pady 0 -side top pack .nbSSF.frameNB2.lfSignDoc -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 6 -side top pack .nbSSF.frameNB2.lfSignDoc.entSignDoc .nbSSF.frameNB2.lfSignDoc.butSignDoc -in .nbSSF.frameNB2.lfSignDoc labelframe .nbSSF.frameNB2.lfForType -borderwidth {4} -foreground {#141312} -relief {ridge} -text { } -background {#e0dfde} -height {100} -padx {1} -pady {5} -width {100} ttk::combobox .nbSSF.frameNB2.lfForType.comboFor -values {PKCS7 CADES_BES CADES_XLT1} -cursor {xterm} .nbSSF.frameNB2.lfForType.comboFor state {} pack .nbSSF.frameNB2.lfForType.comboFor -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 4 -pady 0 -side left radiobutton .nbSSF.frameNB2.lfForType.radAtt -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text {} -value {1} pack .nbSSF.frameNB2.lfForType.radAtt -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 26 -pady 0 -side left radiobutton .nbSSF.frameNB2.lfForType.radDet -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text {} -value {0} pack .nbSSF.frameNB2.lfForType.radDet -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 13 -pady 0 -side top pack .nbSSF.frameNB2.lfForType -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 16 -side top pack .nbSSF.frameNB2.lfForType.comboFor .nbSSF.frameNB2.lfForType.radAtt .nbSSF.frameNB2.lfForType.radDet -in .nbSSF.frameNB2.lfForType labelframe .nbSSF.frameNB2.lfCert -borderwidth {4} -foreground {#141312} -relief {ridge} -text { } -background {#e0dfde} -height {100} -width {100} entry .nbSSF.frameNB2.lfCert.entCert -background {#FFFAFA} -foreground {#141312} -highlightbackground {#ffffff} -highlightcolor {#141312} -selectbackground {#418bd4} -selectforeground {#ffffff} -width {40} pack .nbSSF.frameNB2.lfCert.entCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 9 -pady 0 -side left button .nbSSF.frameNB2.lfCert.butCert -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text { } pack .nbSSF.frameNB2.lfCert.butCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left pack .nbSSF.frameNB2.lfCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 8 -side top pack .nbSSF.frameNB2.lfCert.entCert .nbSSF.frameNB2.lfCert.butCert -in .nbSSF.frameNB2.lfCert labelframe .nbSSF.frameNB2.lfAtCert -borderwidth {4} -foreground {#141312} -relief {ridge} -text { } -background {#00FF00} -height {100} -width {100} radiobutton .nbSSF.frameNB2.lfAtCert.radAtCert -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text { } -value {1} pack .nbSSF.frameNB2.lfAtCert.radAtCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left radiobutton .nbSSF.frameNB2.lfAtCert.radDetCert -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -text { } -value {0} pack .nbSSF.frameNB2.lfAtCert.radDetCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 10 -pady 0 -side top pack .nbSSF.frameNB2.lfAtCert -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top pack .nbSSF.frameNB2.lfAtCert.radAtCert .nbSSF.frameNB2.lfAtCert.radDetCert -in .nbSSF.frameNB2.lfAtCert button .nbSSF.frameNB2.butSign -activebackground {#e0dfde} -activeforeground {#141312} -background {#20B2AA} -borderwidth {7} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -relief {ridge} -text { } pack .nbSSF.frameNB2.butSign -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 14 -side top pack .nbSSF.frameNB2.lfSignDoc .nbSSF.frameNB2.lfForType .nbSSF.frameNB2.lfCert .nbSSF.frameNB2.lfAtCert .nbSSF.frameNB2.butSign -in .nbSSF.frameNB2 frame .nbSSF.frameNB3 -borderwidth {2} -relief {raised} -background {#e0dfde} -height {30} -highlightbackground {#e0dfde} -highlightcolor {#141312} -width {30} pack .nbSSF -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top labelframe .lfP11 -borderwidth {4} -foreground {#141312} -relief {ridge} -text { } -background {#FFE4B5} -height {100} -width {100} entry .lfP11.entP11 -background {#FFFAFA} -foreground {#141312} -highlightbackground {#ffffff} -highlightcolor {#141312} -selectbackground {#418bd4} -selectforeground {#ffffff} -width {40} pack .lfP11.entP11 -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 8 -pady 0 -side left button .lfP11.butP11 -activebackground {#e0dfde} -activeforeground {#141312} -background {#e0dfde} -borderwidth {4} -foreground {#141312} -highlightbackground {#e0dfde} -highlightcolor {#141312} -relief {ridge} -text { } pack .lfP11.butP11 -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 9 -pady 1 -side top pack .lfP11 -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 14 -side top pack .lfP11.entP11 .lfP11.butP11 -in .lfP11 .nbSSF add .nbSSF.frameNB1 -padding 0 -sticky nsew -state normal -text -image {} -compound none -underline -1 .nbSSF add .nbSSF.frameNB2 -padding 0 -sticky nsew -state normal -text -image {} -compound none -underline -1 .nbSSF add .nbSSF.frameNB3 -padding 0 -sticky nsew -state normal -text -image {} -compound none -underline -1 pack .lfSSF .nbSSF .lfP11 -in .} proc TPcloseWindow. {} { wm state . withdrawn} # User created procedures namespace eval :: { #Creating namespace :: } # Display and start the application if {[info proc TPstartupSrc] != {}} { TPstartupSrc } TPinitVars TPopenWindow. if {[info proc TPendSrc] != {}} { TPendSrc } # End of TKproE generated code #PS > \> # . </spoiler> , , forBook.tcl, TKproE (. ). , C++ convertFromTclToCPPTK.tcl: <source lang="bash">$ convertFromTclToCPPTK.tcl forBook.tcl >forBook.cc $
結果のforBook.ccコードは、ここで見ることができます。 forBook.cc CPPTK (.) :
$ g++ -DUSE_INTERP_RESULT cpptk.cc base/cpptkbase.cc -o forBook forBook.cc -I./cpptk -Ibase -ltcl8.6 -ltk8.6 –pthread $
forBook, (. ). , , . . :
images(create, photo, "stamp_32x32") -data ( "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr … ");
:
wm (iconphoto, ".", "stamp_32x32");
, , , :
".lfSSF.butSSF" << configure () -command (compute); ".nbSSF.frameNB2.lfSignDoc.butSignDoc" << configure () -command (findDoc); ".nbSSF.frameNB2.lfCert.butCert" << configure () -command (findCert); ".lfP11.butP11" << configure () -command (findPrivKey); ".nbSSF.frameNB2.lfForType.radAtt" << configure () -command (updateRad); ".nbSSF.frameNB2.lfForType.radDet" << configure () -command (updateRad); ".nbSSF.frameNB2.lfAtCert.radAtCert" << configure () -command (updateRad); ".nbSSF.frameNB2.lfAtCert.radDetCert" << configure () -command (updateRad); ".nbSSF.frameNB2.butSign" << configure () -command (createSign);
, .
:

以上です。 , . Tcl Tcl/Tk Android.