Lightningbeam/PyGUI-2.5.3/Doc/GridView.html

6 lines
2.4 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>GridView class</title></head><body><h1>class <tt>GridView(<a href="ScrollableView.html">ScrollableView</a>)</tt></h1>A
GridView is a user-defined view structured as a grid of equal-sized
cells. Abstract methods are provided for drawing the contents of a cell
and detecting mouse clicks in a cell based on their row and column
numbers.<br><br><i>Note: Don't confuse this with the <a href="Grid.html">Grid</a> class, which is a container for laying out other components in a grid.</i><br><br>The extent of a GridView is managed through the <tt>num_rows</tt>, <tt>num_columns</tt> and <tt>cell_size</tt> properties. The <tt>extent</tt> property inherited from ScrollableView should not be changed directly.<br><h2>Constructor</h2><blockquote><dl><dt><tt>GridView(num_rows, num_columns, cell_size)</tt></dt><dd>Creates a grid view whose extent initially covers the specified number of rows and columns.<br></dd></dl></blockquote><h2>Properties</h2><blockquote><dl><dt><tt>num_rows</tt></dt><dd>Number of rows in the view's extent.<br><br></dd><dt><tt>num_columns</tt></dt><dd>Number of columns in the view's extent.<br><br></dd><dt><tt>cell_size</tt></dt><dd>The size of each cell. A tuple (width, height).<br><br></dd><dt><tt>backcolor</tt></dt><dd><a href="Color.html">Color</a> with which to fill the background of a cell before calling <tt>draw_cell()</tt>, or <tt>None</tt> for no automatic background fill.<br></dd></dl></blockquote><h2>Abstract Methods</h2><blockquote><dl><dt><tt>draw_cell(</tt><i>canvas</i><tt>,</tt><i> row_number</i><tt>,</tt><i> column_number</i><tt>,</tt><i> cell_rect</i><tt>)</tt></dt><dd>Should draw the specified cell inside the given rectangle.<br><br></dd><dt><tt>click_cell(</tt><i>row_number</i><tt>,</tt> <i>column_number</i><tt>,</tt> <i>event</i><tt>)</tt></dt><dd>Called when a mouse_down event occurs in a cell.</dd></dl></blockquote><h2>Methods</h2><blockquote><dl><dt><tt>cell_rect(</tt><i>row_number</i><tt>,</tt> <i>column_number</i><tt>)</tt></dt><dd>Returns the rectangle corresponding to the cell at the given row and column numbers.<br><br></dd><dt><tt>cell_containing_point(</tt><i>point</i><tt>)</tt></dt><dd>Returns a tuple (<i>row_number, column_number</i>) indicating the cell in which the given point lies.<br></dd></dl></blockquote></body></html>