Init_tk, Usage, Options – Altera Quartus II Scripting User Manual

Page 307: Description, Example, Init_tk –177

Advertising
background image

Chapter 3: Tcl Packages & Commands

3–177

misc

© July 2013

Altera Corporation

Quartus II Scripting Reference Manual

init_tk

Usage

init_tk

Options

None

Description

Initializes a Tk window. If you are using Tk functionality in Tcl, you must run this command first before
running any Tcl scripts.

Example

# Initialize the Tk library
init_tk

# Create a top level and add a title
toplevel .top
wm title .top "Hello World"

# Add widgets
button .top.hello -text Hello -command {puts stdout "Hello, World!"}
pack .top.hello -padx 20 -pady 10

# Without "tkwait", the script finishes at this point and the
# window is destroyed. The "tkwait" command prevents the
# script from finishing until the you close the window.
tkwait window .top

Advertising