reffec.com

pythonhtp1_11.fm Page 406 Friday, December 14, 2001 2:03 PM in Microsoft Office Creation QR Code JIS X 0510 in Microsoft Office pythonhtp1_11.fm Page 406 Friday, December 14, 2001 2:03 PM

pythonhtp1_11.fm Page 406 Friday, December 14, 2001 2:03 PM generate, create qrcode none in microsoft office projects Modified Plessey Graphical User Interface Components: Part 2 11 . The method specified Microsoft Office QR Code as a value for option selectioncommand executes each time an entry in a ScrolledListBox is selected. Setting the vscrollmode option for a ScrolledListBox to "static" ensures that the vertscrollbar subcomponent of the ScrolledListBox (a Tkinter Scrollbar) will always be present. Other possible values are "dynamic" (display the vertscrollbar only if necessary) and "none" (the vertscrollbar will never be displayed).

The default value is "dynamic". Method curselection returns a tuple of the indices of the currently selected items in a ScrolledListBox. The ScrolledListBox component also supports a getcurselection method that returns a tuple of the currently selected values, rather than the values indices.

By default, the user can select only one option in a ScrolledListbox component. A multiple-selection list enables the user to select many items from a ScrolledListbox. A ScrolledListbox s listbox_selectmode option controls how many items a user may select.

Possible values are SINGLE, BROWSE (default), MULTIPLE and EXTENDED. Value SINGLE allows the user to select only one item in the ScrolledListbox at a time. Value BROWSE is the same as SINGLE, except that the user also may move the selection by dragging the mouse, rather than simply clicking an item.

Value MULTIPLE allows the user to select multiple options, by clicking on multiple values. Value EXTENDED acts like BROWSE, except that when the user drags the mouse, the user selects multiple values. A multiple-selection list does not have a specific event associated with making multiple selections.

Normally, an external event generated by another GUI component specifies when the multiple selections in a ScrolledListbox should be processed. Tkinter Text components provide an area for manipulating multiple lines of text. Pmw defines a ScrolledText component, which is a scrolled Tkinter Text.

Sometimes, no event types are bound for a ScrolledText. Instead, an external event indicates when the text in a ScrolledText should be processed. The ScrolledText component s wrap option controls the appearance of text lines that are too long to display in the component.

Value NONE (default) for wrap means that the component truncates the line and displays only the text that fits in the component. Value CHAR for wrap means that the text is broken up when it becomes too long; the remainder of the text is displayed on the next line. Value WORD for wrap is similar to value CHAR, except that the component breaks the text on word boundaries.

This last value enables word-wrapping, a common feature in many popular text editors. Setting a text subcomponent s state as DISABLED renders the text area uneditable by disabling calls to insert and delete for the component. The ScrolledText component s method get retrieves the user-entered text.

Method get takes two arguments that specify the range of text to retrieve from the component. Constant SEL_FIRST specifies the beginning of the selection. Constant SEL_LAST specifies the end of the selection.

Method settext deletes the current text in the component and inserts the specified text. Menus are an integral part of GUIs. Menus allow the user to perform actions without unnecessarily cluttering a graphical user interface with extra GUI components.

Simple Tkinter GUIs create menus with Menu components. However, Pmw supplies class MenuBar, which contains the methods necessary to manage a menu bar, a container for menus. A menu item is a GUI component inside a menu that causes an action to be performed when selected.

Menu items can be of different forms.. pythonhtp1_11.fm Page 407 Friday, December 14, 2001 2:03 PM 11 . Graphical User Interface Components: Part 2 A command menu item i qr-codes for None nitiates an action. When the user selects a command menu item, the item s callback method is invoked. A checkbutton menu item can be toggled on or off.

When a checkbutton menu item is selected, a check appears to the left of the menu item. When the checkbutton menu item is selected again, the check to the left of the menu item is removed. When multiple radiobutton menu items are assigned to the same variable, only one item in the group can be selected at a given time.

When a radiobutton menu item is selected, a check appears to the left of the menu item. When another radiobutton menu item is selected, the check to the left of the previously selected menu item is removed. A separator menu item is a horizontal line in a menu that groups menu items logically.

A cascade menu item is a submenu. A submenu (or cascade menu) provides more menu items from which the user can select. When a menu is clicked, the menu expands to show its list of menu items and submenus.

Clicking a menu item generates an event. A balloon (also called a tool-tip) displays helpful text for menus and menu items. When the user moves the mouse cursor over a menu or menu item with a balloon, the program displays a specified help message.

Option balloon specifies a Balloon component that is attached to the menu. Method addmenu of Pmw class MenuBar adds a new menu. The method s first argument contains the name of the menu; the second argument contains the text that appears in the menu s balloon.

When the user places the mouse cursor over the menu, the program displays this text. Method addmenuitem of Pmw class MenuBar adds a menu item to a menu. This method requires two arguments: the name of the menu to which the item belongs and the menu item s type.

MenuBar method addmenuitem s keyword argument label specifies the menu item s text. Keyword argument command specifies the item s callback. Method addcascademenu of Pmw class MenuBar adds a submenu to an existing menu.

The method requires two arguments: the name of the menu to which the submenu belongs and the submenu s text. Many of today s computer applications provide context-sensitive popup menus. These menus provide options that are specific to the component for which the popup trigger event was generated.

Context menus be created easily with Tkinter class Menu (a subclass of Widget). A popup trigger event must be specified by binding a callback to the desired trigger for a component. The Frame constructor s bg option takes a string specifying the Frame s background color.

Setting a Menu s tearoff option to 0 removes the dashed separator line that is, by default, the first entry in a Menu. Menu method post displays a Menu at a given position. This method accepts two arguments that correspond to the position on the top-level component at which the menu is displayed.

The current mouse position is specified by the x_root and y_root attributes of the Event instance passed to an event handler. Canvas is a Tkinter component that displays text, images, lines and shapes. Canvas inherits from Widget.

By default, a Canvas is blank. To display items on a Canvas, a program creates canvas items. New items are drawn on top of existing items unless otherwise specified.

Adding canvas items to a Canvas displays something on the Canvas. Each canvas item has a corresponding Canvas method that creates the item and adds it to the canvas..

Copyright © reffec.com . All rights reserved.