Tix Standard Widgets Overview

Tix adds five new standard widgets to Tk: tixGrid, tixHList, tixInputOnly, tixNote-BookFrame, and tixTList. These widgets add new features to Tk that could not be constructed from the standard Tk widgets.

Display Items

Three of the standard widgets added to Tk by Tix are designed to arrange and display items in a list or grid without regard to how each item is actually drawn. They simply treat the items as rectangular boxes and leave the drawing part to the item itself. To this end, all three widgets, called host widgets, support a set of items with a common interface, called display items.

Tix currently has four types of display items: image, text, imagetext, and window. A C API exists for the programmer to add more item types. The appearance of each item is controlled by option-value pairs specified at creation in a manner similar to how items of the canvas widget are configured. Each host widget also supports an entryconfigure method for changing options for existing items.

Since several or all items in a host widget will share common display attributes, Tix supports the concept of display styles. Each display item supports the -style option, which accepts as a value a display style as Returned by the tixDisplayStyle command. The tixDisplayStyle command is described in detail in the "Tix Core Commands" section, later in this chapter. In short, it defines a style by defining values for a subset of the style options a display item type supports. Display items are configured to use the style using the -style option. Changes to the style at a later time will be reflected in all display items connected to the style.

Image Items

Display items of the type image are used to display Tk images. Image items support the following options:

-image imageName (image, Image)

Image to display in the item.

-style displayStyle (imageStyle, ImageStyle)

Display style to which to connect the item.

Image items support the following standard widget options as style options:

-activebackground

-activeforeground

-anchor

-background

-disabledbackground

-disabledforeground

-foreground

-padx

-pady

-selectbackground

-selectforeground

 

Imagetext Items

Display items of the type imagetext are used to display an image and a text string together. Imagetext items support the following options:

-bitmap bitmap (bitmap, Bitmap)

Bitmap to display in the item.

-image imageName (image, Image)

Image to display in the item. Overrides the -bitmap option.

-style displayStyle (imageTextStyle, ImageTextStyle)

Display style to which to connect the item.

-showimage boolean (showImage, ShowImage)

Whether image/bitmap should be displayed.

-showtext boolean (showText, ShowText)

Whether text string should be displayed.

-text string (text, Text)

Text string to display in the item.

-underline string (underline, Underline)

Text string to display in the item.

Imagetext items support the following standard widget options as style options:

-activebackground

-activeforeground

-anchor

-background

-disabledbackground

-disabledforeground

-font

-foreground

-justify

-padx

-pady

-selectbackground

-selectforeground

-wraplength

 

Imagetext items support the following special style option:

-gap amount (gap, Gap)

Distance in pixels between the bitmap/image and the text string.

Text Items

Display items of the type text are used to display a simple text string. Text items support the following options:

-style displayStyle (textStyle, TextStyle)

Display style to which to connect the item.

-text string (text, Text)

Text string to display in the item.

-underline string (underline, Underline)

Text string to display in the item.

Text items support the following standard widget options as style options:

-activebackground

-activeforeground

-anchor

-background

-disabledbackground

-disabledforeground

-font

-foreground

-justify

-padx

-pady

-selectbackground

-selectforeground

-wraplength

 

Window Items

Display items of the type window are used to display a subwindow in a host widget. Window items support the following options:

-style displayStyle (windowStyle, WindowStyle)

Display style to which to connect the item.

-window pathName (window, Window)

pathName of widget to display as a subwindow in the item.

Window items support the following standard widget options as style options:

-anchor

-padx

-pady

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset