Package tkintertable :: Module Tables :: Class TableCanvas
[hide private]
[frames] | no frames]

Class TableCanvas

source code

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
         Tkinter.XView --+    
                         |    
         Tkinter.YView --+    
                         |    
            Tkinter.Canvas --+
                             |
                            TableCanvas
Known Subclasses:

A tkinter class for providing table functionality

Nested Classes [hide private]

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods [hide private]
 
__init__(self, parent=None, model=None, width=None, height=None, rows=10, cols=5, **kwargs)
Construct a canvas widget with the parent MASTER.
source code
 
set_defaults(self)
Set default settings
source code
 
setFontSize(self)
Set font size to match font, we need to get rid of fontsize as a separate variable?
source code
 
mouse_wheel(self, event)
Handle mouse wheel scroll for windows
source code
 
do_bindings(self)
Bind keys and mouse clicks, this can be overriden
source code
 
getModel(self)
Get the current table model
source code
 
setModel(self, model)
Set a new model - requires redraw to reflect changes
source code
 
createfromDict(self, data)
Attempt to create a new model/table from a dict
source code
 
createTableFrame(self, callback=None)
Adds column header and scrollbars and combines them with the current table adding all to the master frame provided in constructor.
source code
 
getVisibleRegion(self) source code
 
getRowPosition(self, y) source code
 
getColPosition(self, x) source code
 
getVisibleRows(self, y1, y2)
Get the visible row range
source code
 
getVisibleCols(self, x1, x2)
Get the visible column range
source code
 
redrawVisible(self, event=None, callback=None)
Redraw the visible portion of the canvas
source code
 
redrawTable(self, event=None, callback=None) source code
 
redrawCell(self, row=None, col=None, recname=None, colname=None)
Redraw a specific cell only
source code
 
adjustColumnWidths(self)
Optimally adjust col widths to accomodate the longest entry in each column - usually only called on first redraw
source code
 
autoResizeColumns(self)
Automatically set nice column widths and draw
source code
 
setColPositions(self)
Determine current column grid positions
source code
 
sortTable(self, columnIndex=0, columnName=None, reverse=0)
Set up sort order dict based on currently selected field
source code
 
set_xviews(self, *args)
Set the xview of table and col header
source code
 
set_yviews(self, *args)
Set the xview of table and row header
source code
 
addRow(self, key=None, **kwargs)
Add new row
source code
 
addRows(self, num=None)
Add new rows
source code
 
addColumn(self, newname=None)
Add a new column
source code
 
deleteRow(self)
Delete a row
source code
 
deleteColumn(self)
Delete currently selected column
source code
 
deleteCells(self, rows, cols)
Clear the cell contents
source code
 
clearData(self, evt=None)
Delete cells from gui event
source code
 
autoAddColumns(self, numcols=None)
Automatically add x number of cols
source code
 
getRecordInfo(self, row)
Show the record for this row
source code
 
findValue(self, searchstring=None, findagain=None)
Return the row/col for the input value
source code
 
showAll(self) source code
 
doFilter(self, event=None)
Filter the table display by some column values.
source code
 
createFilteringBar(self, parent=None, fields=None)
Add a filter frame
source code
 
showFilteringBar(self) source code
 
closeFilterFrame(self)
Callback for closing filter frame
source code
 
resizeColumn(self, col, width)
Resize a column by dragging
source code
 
get_currentRecord(self)
Get the currently selected record
source code
 
get_currentColName(self)
Get the currently selected record name
source code
 
get_currentRecordName(self)
Get the currently selected record name
source code
 
get_selectedRecordNames(self)
Get a list of the current multiple selection, if any
source code
 
get_currentRecCol(self)
Get the clicked rec and col names as a tuple
source code
 
get_row_clicked(self, event)
get row where event on canvas occurs
source code
 
get_col_clicked(self, event)
get col where event on canvas occurs
source code
 
setSelectedRow(self, row)
Set currently selected row and reset multiple row list
source code
 
setSelectedCol(self, col)
Set currently selected column
source code
 
setSelectedCells(self, startrow, endrow, startcol, endcol)
Set a block of cells selected
source code
 
getSelectedRow(self)
Get currently selected row
source code
 
getSelectedColumn(self)
Get currently selected column
source code
 
select_All(self)
Select all rows and cells
source code
 
getCellCoords(self, row, col)
Get x-y coordinates to drawing a cell in a given row/col
source code
 
getCanvasPos(self, row, col)
Get the cell x-y coords as a fraction of canvas size
source code
 
isInsideTable(self, x, y)
Returns true if x-y coord is inside table bounds
source code
 
setRowHeight(self, h)
Set the row height
source code
 
clearSelected(self) source code
 
gotoprevRow(self)
Programmatically set previous row - eg.
source code
 
gotonextRow(self)
Programmatically set next row - eg.
source code
 
handle_left_click(self, event)
Respond to a single press
source code
 
handle_left_release(self, event) source code
 
handle_left_ctrl_click(self, event)
Handle ctrl clicks for multiple row selections
source code
 
handle_left_shift_click(self, event)
Handle shift click, for selecting multiple rows
source code
 
handle_mouse_drag(self, event)
Handle mouse moved with button held down, multiple selections
source code
 
handle_arrow_keys(self, event)
Handle arrow keys press
source code
 
handle_double_click(self, event)
Do double click stuff.
source code
 
handle_right_click(self, event)
respond to a right click
source code
 
handle_motion(self, event)
Handle mouse motion on table
source code
 
gotonextCell(self, event)
Move highlighted cell to next cell in row or a new col
source code
 
movetoSelectedRow(self, row=None, recname=None)
Move to selected row, updating table
source code
 
handleFormulaClick(self, row, col)
Do a dialog for cell formula entry
source code
 
formula_Dialog(self, row, col, currformula=None)
Formula dialog
source code
 
convertFormulae(self, rows, cols=None)
Convert the formulas in the cells to their result values
source code
 
paste(self, event=None)
Copy from clipboard
source code
 
copyCell(self, rows, cols=None)
Copy cell contents to a temp internal clipboard
source code
 
pasteCell(self, rows, cols=None)
Paste cell from internal clipboard
source code
 
copyColumns(self)
Copy current selected cols
source code
 
pasteColumns(self, coldata)
Paste new cols, overwrites existing names
source code
 
setcellColor(self, rows, cols=None, newColor=None, key=None, redraw=True)
Set the cell color for one or more cells and save it in the model color
source code
 
popupMenu(self, event, rows=None, cols=None, outside=None)
Add left and right click behaviour for canvas, should not have to override this function, it will take its values from defined dicts in constructor
source code
 
fillDown(self, rowlist, collist)
Fill down a column, or multiple columns
source code
 
fillAcross(self, collist, rowlist)
Fill across a row, or multiple rows
source code
 
getSelectionValues(self)
Get values for current multiple cell selection
source code
 
plotSelected(self, graphtype='XY')
Plot the selected data using pylab - if possible
source code
 
plotSetup(self)
Call pylab plot dialog setup, send data if we haven't already plotted
source code
 
getplotlabels(self)
Get labels for plot series from col labels
source code
 
drawGrid(self, startrow, endrow)
Draw the table grid lines
source code
 
drawRowHeader(self)
User has clicked to select a cell
source code
 
drawSelectedRect(self, row, col, color=None)
User has clicked to select a cell
source code
 
drawRect(self, row, col, color=None, tag=None, delete=1)
Cell is colored
source code
 
drawCellEntry(self, row, col, text=None)
When the user single/double clicks on a text/number cell, bring up entry window
source code
 
checkDataEntry(self, event=None)
do validation checks on data entry in a widget
source code
 
drawText(self, row, col, celltxt, fgcolor=None, align=None)
Draw the text inside a cell area
source code
 
isLink(self, cell)
Checks if cell is a hyperlink, without using isinstance
source code
 
drawSelectedRow(self)
Draw the highlight rect for the currently selected row
source code
 
drawSelectedCol(self, col=None, delete=1)
Draw an outline rect fot the current column selection
source code
 
drawMultipleRows(self, rowlist)
Draw more than one row selection
source code
 
drawMultipleCells(self)
Draw an outline box for multiple cell selection
source code
 
drawTooltip(self, row, col)
Draw a tooltip showing contents of cell
source code
 
setcellbackgr(self) source code
 
setgrid_color(self) source code
 
setrowselectedcolor(self) source code
 
getaColor(self, oldcolor) source code
 
showtablePrefs(self, prefs=None)
Show table options dialog using an instance of prefs
source code
 
getFonts(self) source code
 
loadPrefs(self, prefs=None)
Load table specific prefs from the prefs instance used if they are not present, create them.
source code
 
savePrefs(self)
Save and set the prefs
source code
 
applyPrefs(self)
Apply prefs to the table by redrawing
source code
 
AskForColorButton(self, frame, text, func) source code
 
check_hyperlink(self, event=None)
Check if a hyperlink was clicked
source code
 
show_progressbar(self, message=None)
Show progress bar window for loading of data
source code
 
updateModel(self, model)
Call this method to update the table model
source code
 
new(self)
Clears all the data and makes a new table
source code
 
load(self, filename=None)
load from a file
source code
 
save(self, filename=None)
Save model to pickle file
source code
 
importTable(self)
Import from csv file
source code
 
exportTable(self, filename=None)
Do a simple export of the cell contents to csv
source code
 
getGeometry(self, frame)
Get frame geometry
source code

Inherited from Tkinter.Canvas: addtag, addtag_above, addtag_all, addtag_below, addtag_closest, addtag_enclosed, addtag_overlapping, addtag_withtag, bbox, canvasx, canvasy, coords, create_arc, create_bitmap, create_image, create_line, create_oval, create_polygon, create_rectangle, create_text, create_window, dchars, delete, dtag, find, find_above, find_all, find_below, find_closest, find_enclosed, find_overlapping, find_withtag, focus, gettags, icursor, index, insert, itemcget, itemconfig, itemconfigure, lift, lower, move, postscript, scale, scan_dragto, scan_mark, select_adjust, select_clear, select_from, select_item, select_to, tag_bind, tag_lower, tag_raise, tag_unbind, tkraise, type

Inherited from Tkinter.Canvas (private): _create

Inherited from Tkinter.BaseWidget: destroy

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

Inherited from Tkinter.Misc: __contains__, __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, 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, 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, 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 Tkinter.XView: xview, xview_moveto, xview_scroll

Inherited from Tkinter.YView: yview, yview_moveto, yview_scroll

Class Methods [hide private]
 
checkOSType(cls)
Check the OS we are in
source code
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, parent=None, model=None, width=None, height=None, rows=10, cols=5, **kwargs)
(Constructor)

source code 

Construct a canvas widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, closeenough, confine, cursor, height, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, offset, relief, scrollregion, selectbackground, selectborderwidth, selectforeground, state, takefocus, width, xscrollcommand, xscrollincrement, yscrollcommand, yscrollincrement.

Overrides: Tkinter.BaseWidget.__init__
(inherited documentation)

createTableFrame(self, callback=None)

source code 

Adds column header and scrollbars and combines them with the current table adding all to the master frame provided in constructor. Table is then redrawn.

doFilter(self, event=None)

source code 

Filter the table display by some column values. We simply pass the model search function to the the filtering class and that handles everything else. See filtering frame class for how searching is done.

gotoprevRow(self)

source code 

Programmatically set previous row - eg. for button events

gotonextRow(self)

source code 

Programmatically set next row - eg. for button events

handle_double_click(self, event)

source code 

Do double click stuff. Selected row/cols will already have been set with single click binding