- Tcl Tutorial
- Tcl - Home
- Tcl - Overview
- Tcl - Environment Setup
- Tcl - Special Variables
- Tcl - Basic Syntax
- Tcl - Commands
- Tcl - Data Types
- Tcl - Variables
- Tcl - Operators
- Tcl - Decisions
- Tcl - Loops
- Tcl - Arrays
- Tcl - Strings
- Tcl - Lists
- Tcl - Dictionary
- Tcl - Procedures
- Tcl - Packages
- Tcl - Namespaces
- Tcl - File I/O
- Tcl - Error Handling
- Tcl - Built-in Functions
- Tcl - Regular Expressions
- Tk Tutorial
- Tk - Overview
- Tk - Environment
- Tk - Special Variables
- Tk - Widgets Overview
- Tk - Basic Widgets
- Tk - Layout Widgets
- Tk - Selection Widgets
- Tk - Canvas Widgets
- Tk - Mega Widgets
- Tk - Fonts
- Tk - Images
- Tk - Events
- Tk - Windows Manager
- Tk - Geometry Manager
- Tcl/Tk Useful Resources
- Tcl/Tk - Quick Guide
- Tcl/Tk - Useful Resources
- Tcl/Tk - Discussion
Tk - Canvas Image Widget
Image widget is used to create a displayed image item. An image can be created from a GIF, PNG, PPM, PGM, or X-Bitmap image. The syntax for image widget is shown below.
canvasName create image x y options
x and y set the location of a bitmap.
Option
The option available for the image widget are listed below in the following table −
Sr.No. | Syntax & Description |
---|---|
1 | -image imageName The variable that holds image to display. |
A simple example for image widget is shown below −
#!/usr/bin/wish canvas .myCanvas -background red -width 100 -height 100 pack .myCanvas set myImage [image create photo] $myImage read "/Users/myImages/myImage1.png" .myCanvas create image 50 50 -image $myImage
When we run the above program, we will get the following output −
tk_canvas_widgets.htm
Advertisements