Previous
Tcl/Tk Tutorial - Create GUI using Tk with Tcl Language
Tcl/Tk Tutorial - Create GUI using Tk with Tcl Language
Next
Legal
Legal
Tcl/Tk Tutorial - Create GUI using Tk with Tcl Language
Contents
Contents
A Tcl(Tutorial for Cool Languages) for Tcl/Tk : Contents
Starting PageContents
Legal
Introduction
TCL
SyntaxHello World Program
Exercise
String Manipulation
Lists
Lists
Arrays
Control Flow
If statement
For and Foreach
For
Foreach
While
Switch
Functions
File Handling
open
puts
close
gets
seek
read
TK
TKWidgets 1
Button
Entry
Label
Widgets 2
Frame
Text
Scrollbar
Scale
Grid
Widgets 3
Radiobutton
Checkbutton
Widgets 4
Listbox
Widgets 5
Menubutton
Menu
tk_optionMenu
Widgets 6
Canvas
Message
Panedwindow
Spinbox
Dialogs
tk_messageBox
tk_chooseDirectory
tk_chooseColor
tk_getOpenFile
toplevel
Geometry Managers
Grid
Pack
Common Options
Some Tk Commands
Bind
The End
What Now?Reference
Appendix
A. Answers
B. Common Tcl/Tk Mistakes
C. Tcl/Tk in Unix
D. About the Author - Site
E. Codes
F. FeedBack/Rate the Tutorial.
G. What's New.

Comments
How can I insert a data inserted in a textbox into database in TCL-TK????
how do i link an executable C file with the button ????? Plz help..
thanks,
How Can I read a user data interactively? or How can I read a data entered in text box to be used in a procedure?
Thanks.
How can I use Tcl steal space telescope for benefit glorious nation of Kazakhstan? Plz send codes thx.
Thanks a lot for this tutorial. I came here for the Tk portion, and find your website very concise and to the point --a great way to get started on Tcl/Tk.
How do I insert data from a database into a text box? The code I have constructed is ...
# +-------------------------------------------------+
# + Initial TK Widget Definitions For Viewer Window +
# +-------------------------------------------------+
wm title . "mysqltcl: login"
# +--------------+
# + Menu Widgets +
# +--------------+
panedwindow .p -orient vertical -showhandle 1
pack .p -expand yes -fill both
# create labelframe widget, containing a gridded text and scrollbar assembly
foreach {w label} {result "Query result:"} {
set f [labelframe .p.$w -text $label]
text $f.t -height 10 -width 40 \
-wrap none -font {courier 12} \
-xscrollcommand [list $f.xbar set] \
-yscrollcommand [list $f.ybar set]
scrollbar $f.xbar -orient horizontal \
-command [list $f.t xview]
scrollbar $f.ybar -orient vertical \
-command [list $f.t yview]
grid $f.t -row 0 -column 0 -sticky news -padx 2 -pady 2
grid $f.ybar -row 0 -column 1 -sticky ns -padx 2 -pady 2
grid $f.xbar -row 1 -column 0 -sticky ew -padx 2 -pady 2
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
#add the frame assembly to the panedwindow
.p add $f -minsize 1i -padx 4 -pady 6
}
set h [mysqlconnect -db homeinfo -port 3309 -user me -password mypassword]
mysqluse $h "mydatabase"
mysqlsel $h "select title, author from books" -list
#using fetch
# while {[llength [set row [mysql::fetch $h]]]>0} {
# # row is always a list. using lindex avoids conversion list to string
# $t get {[lindex $row 0]}
#
# }
mysql::map $h host {
t -text insert end [puts $h]
}
label .fllabel -text "test" -relief sunken -bg NavajoWhite2 -fg Navy -anchor nw
#pack .fl .fllabel .flname -side top -padx 1m -pady 1m -anchor nw
button .getconnected -text "Connect to MySQL" -command getConnected
button .exitpgm -text "Exit Program" -fg Navy -bg NavajoWhite2 -font bold -command exitpgm
pack .exitpgm .getconnected \
-side bottom -padx 1m -pady 1m
#pack .flhost .flport .fluser .flconnection -side bottom -padx 1m -pady 1m
Thanks
Michael
I am a newbie to Tk ?..Can somebody tell me if Tk can be used to read data from UNIX based GUI interfaces.?
Like everyone else, I'm an anoymous poster trying to get everyone else to do my work for me. Why don't I go do some research rather than just asking questions and not contributing to anything anyone else has posted?
a, strong, em, b, i, code, pre, pandbrallowed. Other tags will be shown as code(< will become <). Urls, Line breaks will be auto-formated.