Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes | Static Private Attributes
tkinter.StringVar Class Reference
Inheritance diagram for tkinter.StringVar:
Inheritance graph
[legend]
Collaboration diagram for tkinter.StringVar:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def get
def __str__
def set
def trace_variable
def trace_vdelete
def trace_vinfo
def __eq__

Static Public Attributes

 trace = trace_variable

Static Private Attributes

string _default = ""

Detailed Description

Value holder for strings variables.

Definition at line 230 of file __init__.py.


Constructor & Destructor Documentation

def tkinter.StringVar.__init__ (   self,
  master = None,
  value = None,
  name = None 
)
Construct a string variable.

MASTER can be given as master widget.
VALUE is an optional value (defaults to "")
NAME is an optional Tcl name (defaults to PY_VARnum).

If NAME matches an existing variable and VALUE is omitted
then the existing value is retained.

Reimplemented from tkinter.Variable.

Definition at line 233 of file __init__.py.

00233 
00234     def __init__(self, master=None, value=None, name=None):
00235         """Construct a string variable.
00236 
00237         MASTER can be given as master widget.
00238         VALUE is an optional value (defaults to "")
00239         NAME is an optional Tcl name (defaults to PY_VARnum).
00240 
00241         If NAME matches an existing variable and VALUE is omitted
00242         then the existing value is retained.
00243         """
00244         Variable.__init__(self, master, value, name)

Here is the caller graph for this function:


Member Function Documentation

def tkinter.Variable.__eq__ (   self,
  other 
) [inherited]
Comparison for equality (==).

Note: if the Variable's master matters to behavior
also compare self._master == other._master

Definition at line 221 of file __init__.py.

00221 
00222     def __eq__(self, other):
00223         """Comparison for equality (==).
00224 
00225         Note: if the Variable's master matters to behavior
00226         also compare self._master == other._master
00227         """
00228         return self.__class__.__name__ == other.__class__.__name__ \
00229             and self._name == other._name

def tkinter.Variable.__str__ (   self) [inherited]
Return the name of the variable in Tcl.

Definition at line 187 of file __init__.py.

00187 
00188     def __str__(self):
00189         """Return the name of the variable in Tcl."""
        return self._name
def tkinter.StringVar.get (   self)
Return value of variable as string.

Reimplemented from tkinter.Variable.

Definition at line 245 of file __init__.py.

00245 
00246     def get(self):
00247         """Return value of variable as string."""
00248         value = self._tk.globalgetvar(self._name)
00249         if isinstance(value, str):
00250             return value
00251         return str(value)

Here is the caller graph for this function:

def tkinter.Variable.set (   self,
  value 
) [inherited]
Set the variable to VALUE.

Reimplemented in tkinter.IntVar.

Definition at line 190 of file __init__.py.

00190 
00191     def set(self, value):
00192         """Set the variable to VALUE."""
        return self._tk.globalsetvar(self._name, value)

Here is the caller graph for this function:

def tkinter.Variable.trace_variable (   self,
  mode,
  callback 
) [inherited]
Define a trace callback for the variable.

MODE is one of "r", "w", "u" for read, write, undefine.
CALLBACK must be a function which is called when
the variable is read, written or undefined.

Return the name of the callback.

Definition at line 196 of file __init__.py.

00196 
00197     def trace_variable(self, mode, callback):
00198         """Define a trace callback for the variable.
00199 
00200         MODE is one of "r", "w", "u" for read, write, undefine.
00201         CALLBACK must be a function which is called when
00202         the variable is read, written or undefined.
00203 
00204         Return the name of the callback.
00205         """
00206         cbname = self._master._register(callback)
00207         self._tk.call("trace", "variable", self._name, mode, cbname)
        return cbname
def tkinter.Variable.trace_vdelete (   self,
  mode,
  cbname 
) [inherited]
Delete the trace callback for a variable.

MODE is one of "r", "w", "u" for read, write, undefine.
CBNAME is the name of the callback returned from trace_variable or trace.

Definition at line 209 of file __init__.py.

00209 
00210     def trace_vdelete(self, mode, cbname):
00211         """Delete the trace callback for a variable.
00212 
00213         MODE is one of "r", "w", "u" for read, write, undefine.
00214         CBNAME is the name of the callback returned from trace_variable or trace.
00215         """
00216         self._tk.call("trace", "vdelete", self._name, mode, cbname)
        self._master.deletecommand(cbname)
def tkinter.Variable.trace_vinfo (   self) [inherited]
Return all trace callback information.

Definition at line 217 of file __init__.py.

00217 
00218     def trace_vinfo(self):
00219         """Return all trace callback information."""
00220         return [self._tk.split(x) for x in self._tk.splitlist(
            self._tk.call("trace", "vinfo", self._name))]

Member Data Documentation

string tkinter.StringVar._default = "" [static, private]

Reimplemented from tkinter.Variable.

Definition at line 232 of file __init__.py.

tkinter.Variable.trace = trace_variable [static, inherited]

Definition at line 208 of file __init__.py.


The documentation for this class was generated from the following file: