]> git.saurik.com Git - wxWidgets.git/blame_incremental - utils/wxPython/demo/wxGrid.py
gtk and msw build dirs
[wxWidgets.git] / utils / wxPython / demo / wxGrid.py
... / ...
CommitLineData
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6class TestGrid(wxGrid):
7 def __init__(self, parent, log):
8 wxGrid.__init__(self, parent, -1)
9 self.log = log
10
11 self.CreateGrid(16, 16)
12 self.SetColumnWidth(3, 200)
13 self.SetRowHeight(4, 45)
14 self.SetCellValue("First cell", 0, 0)
15 self.SetCellValue("Another cell", 1, 1)
16 self.SetCellValue("Yet another cell", 2, 2)
17 self.SetCellTextFont(wxFont(12, wxROMAN, wxITALIC, wxNORMAL), 0, 0)
18 self.SetCellTextColour(wxRED, 1, 1)
19 self.SetCellBackgroundColour(wxCYAN, 2, 2)
20 self.UpdateDimensions()
21 self.AdjustScrollbars()
22
23 EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
24 EVT_GRID_CELL_CHANGE(self, self.OnCellChange)
25 EVT_GRID_CELL_LCLICK(self, self.OnCellClick)
26 EVT_GRID_LABEL_LCLICK(self, self.OnLabelClick)
27
28 self.SetEditInPlace(true)
29 #print self.GetCells()
30
31
32 def OnSelectCell(self, event):
33 self.log.WriteText("OnSelectCell: (%d, %d)\n" % (event.m_row, event.m_col))
34
35 def OnCellChange(self, event):
36 self.log.WriteText("OnCellChange: (%d, %d)\n" % (event.m_row, event.m_col))
37
38 def OnCellClick(self, event):
39 self.log.WriteText("OnCellClick: (%d, %d)\n" % (event.m_row, event.m_col))
40
41 def OnLabelClick(self, event):
42 self.log.WriteText("OnLabelClick: (%d, %d)\n" % (event.m_row, event.m_col))
43
44#---------------------------------------------------------------------------
45
46def runTest(frame, nb, log):
47 win = TestGrid(nb, log)
48 return win
49
50#---------------------------------------------------------------------------
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70overview = """\
71wxGrid is a class for displaying and editing tabular information.
72
73wxGrid()
74-----------------
75
76wxGrid(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style=0, const wxString& name="grid")
77
78Constructor. Before using a wxGrid object, you must call CreateGrid to set up the required rows and columns.
79"""