Package mglutil :: Package gui :: Package BasicWidgets :: Package Tk :: Module Dial :: Class Dial
[hide private]
[frames] | no frames]

Class Dial

source code

   Tkinter.Misc --+            
                  |            
 Tkinter.BaseWidget --+        
                      |        
       Tkinter.Pack --+        
                      |        
      Tkinter.Place --+        
                      |        
       Tkinter.Grid --+        
                      |        
         Tkinter.Widget --+    
                          |    
              Tkinter.Frame --+
                              |
KeyboardEntry.KeyboardEntry --+
                              |
                             Dial

This class implements a Dial widget. The widget has a pointer that can be moved around a circle. The range corresponding to one full turn can be specified as well as the min and max values that are allowed. By defaults these are set to None meaning that there is no min and no max. One turn corresponds to 360 units by default. A dial can also operate in discrete mode (if self.increment is set to x). In this mode the values will be restrained to be multiples of self.increment.

The Widget has a Callback manager. Callback functions get called at every value change if self.contiguous is set to 1, else they get called when the mouse button is released. They always get called with the current value as an argument.

An optional label can be displayed at the center of the Dial widget. The size of the dial has to be specified at instanciation. Other parameters can be set after the widget has been created. The widget tried to adjust automatically the size of the arrow according to the size of the dial.

The widget has a configure() method: type, min, max, increment, precision, showLabel, value, continuous, oneTurn can be set this way.

master, labCfg and size can be passed only to the constructor.

a lock() method is used to disable the various gui components of the options panel. Usage: <instance>.lock(<component>=<value>) components see configure(). value is 0 or 1. 1 disables, 0 enables.

Setting values with increment enabled: if using the method set(), the actual value will 'snap' to the next increment. i.e., if the value is set to 3, and the increment is set to 2, setting the value to 6 will actually result in 7 (3,5,7,9,.....) To still be able to set the value, disregarding the current active increment, the set method understands the optional keyword force=True, i.e. dial.set(<value>, force=True)), which will set the value to <value>. The increment will now be added to this new <value>

Nested Classes [hide private]

Inherited from Tkinter.Misc: getdouble, getint


Instance Methods [hide private]
  __init__(self, master=None, type='float', labCfg={'fg': 'black','side': 'left','text': None}, min=None, max=None, increment=.0, precision=2, showLabel=1, value=0.0, continuous=1, oneTurn=360., size=50, callback=None, lockMin=0, lockBMin=0, lockMax=0, lockBMax=0, lockIncrement=0, lockBIncrement=0, lockPrecision=0, lockShowLabel=0, lockValue=0, lockType=0, lockContinuous=0, lockOneTurn=0, **kw)
Construct a frame widget with the parent MASTER.
  setFromEntry(self, valueString)
  handleKeyStroke(self, event)
  setSize(self, size)
Set widget size.
  setCallback(self, cb)
Set widget callback.
  toggleOptPanel(self, event=None)
  setArrow(self, size=None)
  mouseDown(self, event)
  mouseUp(self, event)
  mouseMove(self, event)
  mouseWheel(self, event)
  get(self)
  printLabel(self)
  set(self, val, update=1, force=0)
  drawArrow(self)
  createCanvas(self, master)
  toggleWidgetLabel(self, val)
  setValue(self, val)
  setLabel(self, labCfg)
  configure(self, **kw)
Configure resources of a widget.
  setType(self, Type)
  setMin(self, min)
  setMax(self, max)
  setIncrement(self, incr)
  setPrecision(self, val)
  setContinuous(self, cont)
cont can be None, 0 or 1
  setShowLabel(self, val)
Show label can be 0, 1 or 2 0: no label 1: label is always shown 2: show label only when value changes
  setOneTurn(self, oneTurn)
  lockTypeCB(self, mode)
  lockMinCB(self, mode)
  lockBMinCB(self, mode)
  lockMaxCB(self, mode)
  lockBMaxCB(self, mode)
  lockIncrementCB(self, mode)
  lockBIncrementCB(self, mode)
  lockPrecisionCB(self, mode)
  lockShowLabelCB(self, mode)
  lockValueCB(self, mode)
  lockContinuousCB(self, mode)
  lockOneTurnCB(self, mode)

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.BaseWidget (private): _do, _setup

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, colormodel, columnconfigure, config, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Misc (private): _bind, _configure, _displayof, _getboolean, _getdoubles, _getints, _grid_configure, _nametowidget, _options, _register, _report_exception, _root, _substitute

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Inherited from KeyboardEntry.KeyboardEntry: enter_cb, key_cb, leave_cb, return_cb


Class Variables [hide private]

Inherited from Tkinter.Misc: _noarg_

Inherited from Tkinter.Misc (private): _subst_format, _subst_format_str, _tclCommands


Method Details [hide private]

__init__(self, master=None, type='float', labCfg={'fg': 'black','side': 'left','text': None}, min=None, max=None, increment=.0, precision=2, showLabel=1, value=0.0, continuous=1, oneTurn=360., size=50, callback=None, lockMin=0, lockBMin=0, lockMax=0, lockBMax=0, lockIncrement=0, lockBIncrement=0, lockPrecision=0, lockShowLabel=0, lockValue=0, lockType=0, lockContinuous=0, lockOneTurn=0, **kw)
(Constructor)

source code 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.
Overrides: Tkinter.Frame.__init__
(inherited documentation)

setFromEntry(self, valueString)

source code 
None

handleKeyStroke(self, event)

source code 
None
Overrides: KeyboardEntry.KeyboardEntry.handleKeyStroke

setSize(self, size)

source code 
Set widget size. Size must be of type int and greater than 0

setCallback(self, cb)

source code 
Set widget callback. Must be callable function. Callback is called every time the widget value is set/modified

toggleOptPanel(self, event=None)

source code 
None

setArrow(self, size=None)

source code 
None

mouseDown(self, event)

source code 
None

mouseUp(self, event)

source code 
None

mouseMove(self, event)

source code 
None

mouseWheel(self, event)

source code 
None

get(self)

source code 
None

printLabel(self)

source code 
None

set(self, val, update=1, force=0)

source code 
None

drawArrow(self)

source code 
None

createCanvas(self, master)

source code 
None

toggleWidgetLabel(self, val)

source code 
None

setValue(self, val)

source code 
None

setLabel(self, labCfg)

source code 
None

configure(self, **kw)

source code 

Configure resources of a widget.

The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys.
Overrides: Tkinter.Misc.configure
(inherited documentation)

setType(self, Type)

source code 
None

setMin(self, min)

source code 
None

setMax(self, max)

source code 
None

setIncrement(self, incr)

source code 
None

setPrecision(self, val)

source code 
None

setContinuous(self, cont)

source code 
cont can be None, 0 or 1

setShowLabel(self, val)

source code 
Show label can be 0, 1 or 2 0: no label 1: label is always shown 2: show label only when value changes

setOneTurn(self, oneTurn)

source code 
None

lockTypeCB(self, mode)

source code 
None

lockMinCB(self, mode)

source code 
None

lockBMinCB(self, mode)

source code 
None

lockMaxCB(self, mode)

source code 
None

lockBMaxCB(self, mode)

source code 
None

lockIncrementCB(self, mode)

source code 
None

lockBIncrementCB(self, mode)

source code 
None

lockPrecisionCB(self, mode)

source code 
None

lockShowLabelCB(self, mode)

source code 
None

lockValueCB(self, mode)

source code 
None

lockContinuousCB(self, mode)

source code 
None

lockOneTurnCB(self, mode)

source code 
None