Back to index

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

List of all members.

Public Member Functions

def show

Public Attributes

 master
 options

Static Public Attributes

string command = "tk_chooseColor"

Private Member Functions

def _fixoptions
def _fixresult

Detailed Description

Definition at line 28 of file colorchooser.py.


Member Function Documentation

def tkinter.colorchooser.Chooser._fixoptions (   self) [private]

Reimplemented from tkinter.commondialog.Dialog.

Definition at line 33 of file colorchooser.py.

00033 
00034     def _fixoptions(self):
00035         try:
00036             # make sure initialcolor is a tk color string
00037             color = self.options["initialcolor"]
00038             if isinstance(color, tuple):
00039                 # assume an RGB triplet
00040                 self.options["initialcolor"] = "#%02x%02x%02x" % color
00041         except KeyError:
00042             pass

Here is the caller graph for this function:

def tkinter.colorchooser.Chooser._fixresult (   self,
  widget,
  result 
) [private]

Reimplemented from tkinter.commondialog.Dialog.

Definition at line 43 of file colorchooser.py.

00043 
00044     def _fixresult(self, widget, result):
00045         # result can be somethings: an empty tuple, an empty string or
00046         # a Tcl_Obj, so this somewhat weird check handles that
00047         if not result or not str(result):
00048             return None, None # canceled
00049 
00050         # to simplify application code, the color chooser returns
00051         # an RGB tuple together with the Tk color string
00052         r, g, b = widget.winfo_rgb(result)
00053         return (r/256, g/256, b/256), str(result)
00054 
00055 
00056 #
00057 # convenience stuff

Here is the caller graph for this function:

def tkinter.commondialog.Dialog.show (   self,
  options 
) [inherited]

Definition at line 34 of file commondialog.py.

00034 
00035     def show(self, **options):
00036 
00037         # update instance options
00038         for k, v in options.items():
00039             self.options[k] = v
00040 
00041         self._fixoptions()
00042 
00043         # we need a dummy widget to properly process the options
00044         # (at least as long as we use Tkinter 1.63)
00045         w = Frame(self.master)
00046 
00047         try:
00048 
00049             s = w.tk.call(self.command, *w._options(self.options))
00050 
00051             s = self._fixresult(w, s)
00052 
00053         finally:
00054 
00055             try:
00056                 # get rid of the widget
00057                 w.destroy()
00058             except:
00059                 pass
00060 
00061         return s

Here is the call graph for this function:


Member Data Documentation

string tkinter.colorchooser.Chooser.command = "tk_chooseColor" [static]

Reimplemented from tkinter.commondialog.Dialog.

Definition at line 31 of file colorchooser.py.

Definition at line 23 of file commondialog.py.

Definition at line 24 of file commondialog.py.


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