Previous
Grid, Pack 
Next
Some Tk Commands 
Perl/Tk Tutorial - Create GUI with Perl's Tk Module
Common Widget Options

Some Common Widget Options

The capitalized word must be replaced with any of the bold words. Check the manual for all the options. Also make sure that the widget you are using support the option you are using.

-anchor=>POSITIONPosition widget relative to: n ne nw s se sw e w or center.
-background=>COLORBackground color.
-borderwidth=>WIDTHWidth of border. Choosing '0' will hide the border.
-command=>SCRIPTExecutes SCRIPT when invoked.
-cursor=>CURSORMouse cursor to display when mouse in this widget.
-disabledforeground=>COLORForeground color when the widget is disabled.
-font=>FONTNAMEUse FONTNAME for text style. It is given in this format - FONTNAME SIZE STYLE. For example,
-font => "fixed 12 bold"
-foreground=>COLORForeground when the state of the widget is normal.
-geometry=>WIDTHxHEIGHTCan sets horizontal (and optionally vertical) widget size.
-height=>VALUESet vertical height of the widget.
-image=>IMAGEThe image to display in widget.
-justify=>JUSTIFICATIONMulti-line justification: left, right or center.
-orient=>ORIENTATIONFor objects like scale and scrollbar. Must be horizontal or vertical(or h or v).
-padx=>NUMBERHorizontal padding. The space on top and bottom of the given widget. For example, -padx=>5.
-pady=>NUMBERVertical padding. This is the space on either side of the given widget. For example, -pady=>2.
-relief=>RELIEF3D bevel border - RELIEF must be flat, groove, raised, ridge, solid or sunken. Very useful when using frame.
-state=>STATESet widget to: normal, disabled or active.
-text=>STRINGDisplay text string.
-variable=>VARNAMEDisplay text variable. If the widget is manipulated, the value of the variable will change automatically and if this variable's value is changed, the widget will change to reflect the changes in the variable.
-underline=>CHARWhich character position in string to underline. This must be a number - 0 for the first character, 1 for the second and so on.
-width=>WIDTHSets horizontal widget size.
-wraplength=>LENGTHWord wrapping maximum string length.
Previous
Grid, Pack 
Next
Some Tk Commands 
Subscribe to Feed