grail.widgets.grunfileextension module

Version: 16.2

Table of Contents

Description

The GRunFileExtension widget is what is known as a Compound Widget. This widget provides the user with ability to quickly put together a standard user interface for querying for run file and report file extensions.

Example

The following example illustrates setting up two grail.rtv variables with a GRunFileExtension widget. When the dialog is closed, the results will be displayed in the command window,

import Tkinter
from grail.widgets import *
from grail import rtv

runext = rtv.StringRTV(name="runfile-extension", value="a")
reportext = rtv.StringRTV(name="report-extension", value="rpt")

root = gwidgetinit()
ext = GRunFileExtension(root, run_rtv=runext, report_rtv=reportext)
ext.pack(anchor='nw', expand='y')

root.title("Demo - GRunFileExtension Widget")
root.mainloop()

# after exiting, display to console.
print "run file extension: %s" % (runext.get())
print "report file extension: %s" % (reportext.get())

The widget will appear as follows,

Example of GRunFileExtension widget.

Example of the GRunFileExtension widget.

GRunFileExtension Widget

The GRunFileExtension widget inherits from,
class GRunFileExtension([parent, **keywords])

Provides a standard mechanism for asking the user for an extension for their report file and their run file.

Arguments:
parent : Tkinter.Frame
Parent widget, widget we insert into.
keywords
Variable keyword list defined below.
Keywords:
run_rtv : StringRTV
Holds the value stored for the run file extension.
report_rtv : StringRTV
Holds the value stored for the report file extension.
Signal:
const.sigON_CHANGE

Emitted whenever either the run file extension entry or the report file extension entry change. The receiver should accept two arguments of the form,

receiver(widgetname, value)

Where the widgetname is either 'run' or 'report' and the value is what is stored within the entry.

Components:
runentry
GTextEntry widget for the run file extension.
reportentry
GTextEntry widget for the report file extension.
runlabel
GLabel widget for the run file extension labeling.
reportlabel
GLabel widget for the report file extension labeling.
group
GGroup widget that surrounds the components.

Note

That you can modify the text of the GGroup widget by using the group_text keyword.

destroy()
Handles the Tkinter de-allocation.
disable()
Set the widget to ignore user events.
enable()
Set the widget to respond to user events.
updatevars()
Synchronizes the RTVs with their respective entries.