⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0526-0528.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:


<HTML>

<HEAD>

<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:tcl and tk Programming</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311739 //-->

<!-- TITLE=RED HAT LINUX 2ND EDITION //-->

<!-- AUTHOR=DAVID PITTS ET AL //-->

<!-- PUBLISHER=MACMILLAN //-->

<!-- IMPRINT=SAMS PUBLISHING //-->

<!-- PUBLICATION DATE=1998 //-->

<!-- CHAPTER=25 //-->

<!-- PAGES=0499-0528 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="0522-0525.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch26/0529-0532.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-526"><P>Page 526</P></A>













<P>Listing 25.1. continued

</P>

<!-- CODE //-->

<PRE>

proc setColor {value} {

global color;

foreach i {red green blue} {

set $i [format %02x [.scale_$i get]];

}

set color &quot;#$red$green$blue&quot;;

.preview_label configure -bg $color;

.message_label configure -text &quot;$color&quot;;

}



proc make_preview {} {

global color;



frame .preview_frame;

label .preview_label -bg $color \

-height 5 -width 5;

pack .preview_label -in .preview_frame \

-padx 2 -pady 2 -fill both -anchor c \

-expand 1;

pack .preview_frame -in .control_frame \

-side top -fill both -expand 1 \

-padx 2 -pady 2;

}



proc make_buttons {} {

frame .button_frame;

button .apply -text &quot;apply&quot; -command setRootColor;

button .quit -text &quot;quit&quot; -command exit;

pack .apply .quit -in .button_frame -fill both \

-expand 1 -padx 2 -pady 2 -side left;

pack .button_frame -in .main_frame -fill both;

}



proc setRootColor {} {

global color;



catch {

exec xsetroot -solid $color;

} msg;



if {$msg != {}} {

set msg &quot;An error occurred&quot;;

} else {

set msg &quot;$color&quot;;

}



.message_label configure -text $msg;

}



make_message_label;

make_scales;

make_preview;

</PRE>

<!-- END CODE //-->









<P>make_buttons;

</P>



<A NAME="PAGENUM-527"><P>Page 527</P></A>













<H3><A NAME="ch25_ 24">

Summary

</A></H3>









<P>This chapter is an introduction to programming in

tcl/tk. The examples demonstrate the power of

tcl/tk, which lies in the ability to make user interfaces within a short amount of time

and with little code. Although this chapter covers many of the features of

tcl/tk, there are many more that are not discussed. I hope that with this chapter as a stepping stone, you will

enjoy many years developing tcl/tk applications.

</P>



<A NAME="PAGENUM-528"><P>Page 528</P></A>













<P><CENTER>

<a href="0522-0525.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="../ch26/0529-0532.html">Next</A>

</CENTER></P>









</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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