class MyGrid(gridlib.Grid):
def __init__(self, prnt, ID):
gridlib.Grid.__init__(self, prnt, wx.ID_ANY)
self.CreateGrid(10, 8)
self.SetRowSize(4, 45)
self.SetColSize(3, 200)
self.SetColLabelValue(0, '')
self.SetColLabelValue(1,'Exist. Cond.')
self.SetColLabelValue(2, 'No Action')
self.SetColLabelValue(3, 'Alt. 2')
self.SetRowLabelValue(1, 'Component 1')
self.SetRowLabelValue(2, 'Component 2')
# end of MyGrid class
(plus a bunch more code). It all interprets and displays, but I'm not seeing
what I thought I defined. Instead, there's only one cell and some scroll
bars. See the attached screenshot.
What have I left out so far?
Thanks,
Rich
···
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
Unless you provide some dummy data, no, the grid will not look like much. It's been a long time since I used a raw wxPython grid, but I do remember that much.
I added an additional line, 'self.SetCellValue(4, 4, 'Some text')', but
that made no difference.
Andrea's example, and that in the wxWidgets book show blank cells in
addition to the cells with text and numbers. If one wants to provide a
spreadsheet tool for users, then the empty grid needs to be displayed on the
notebook page's panel.
Don't let me discourage you! Keep those cards and letters of encouragement
coming.
Thanks,
Rich
···
On Tue, 6 Dec 2005, Ed Leafe wrote:
Unless you provide some dummy data, no, the grid will not look like much.
It's been a long time since I used a raw wxPython grid, but I do remember
that much.
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
When I've needed to display an empty grid, I first create an empty data set with the right number of columns, and the number of rows that I want, and call dGrid.DataSet = ds. That's all you need to do in Dabo.
I added an additional line, 'self.SetCellValue(4, 4, 'Some text')', but
that made no difference.
Andrea's example, and that in the wxWidgets book show blank cells in
addition to the cells with text and numbers. If one wants to provide a
spreadsheet tool for users, then the empty grid needs to be displayed on the
notebook page's panel.
I would say a simple but complete working example is "must have" thing then
you looking for a help. Otherwise we are in trouble because any little
detail can be relevant...
Seems like your grid is just happened to be too small. I notice your grid is
placed as notebook page. This may trigger an issue. From my expirence some
"complex" widgets (grid at least) which don't have a strong idea about their
"best size" can behave strangely (in regard of sizing) then placed on
notebook page.
I would say a simple but complete working example is "must have" thing then
you looking for a help. Otherwise we are in trouble because any little
detail can be relevant...
Seems like your grid is just happened to be too small. I notice your grid is
placed as notebook page. This may trigger an issue. From my expirence some
"complex" widgets (grid at least) which don't have a strong idea about their
"best size" can behave strangely (in regard of sizing) then placed on
notebook page.
Sorry, I don't have a simple recipe.
Vladimir Ignatov
www.colorpilot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
Thank you, all. I have it working just fine now. A key problem (perhaps the
major problem) was trying to put the wx.Grid on a wx.Panel, then place that
on the wx.Notebook page.
I followed what Andrea created for his SimpleGrid in the NotebookCtrlDemo,
and created what I needed. Seeing a working example, and futzing with the
code to observe the changes, made it all perfectly clear to me.
The one thing I could not get right was the set of arguments to pass to
self.SetColMinimalWidth(). The wxWidgets book does not provide the arguments,
and the column number and width (in pixels) are only 2 of the required 3.
I've no idea what that third one is, so I set the minimum column width for
each column. I hope that the wxPython book provides the answer to this!
One more notebook pane and the visual component of the UI is done. Thanks
again for all your patient help.
Rich
···
On Tue, 6 Dec 2005, Rich Shepard wrote:
What have I left out so far?
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
The one thing I could not get right was the set of arguments to pass to
self.SetColMinimalWidth(). The wxWidgets book does not provide the arguments,
and the column number and width (in pixels) are only 2 of the required 3.
I've no idea what that third one is, so I set the minimum column width for
each column. I hope that the wxPython book provides the answer to this!
Help on method SetColMinimalWidth in module wx.grid:
SetColMinimalWidth(*args, **kwargs) unbound wx.grid.Grid method
SetColMinimalWidth(self, int col, int width)
I don't see the third argument you are referring to. Beyond the standard 'self', I see 'col' and 'width'.
BTW, I got the above "documentation" using:
pmcnett@sol:~$ python
Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx.grid
help(wx.grid.Grid.SetColMinimalWidth)
From what I remember, basically all wrapped methods have that exact same
call signature as seen from help(). One would likely be better off
paying attent to the wxWindows docs, or even the new wxPython docs
(which are more accurate, but have very little actual documentation): wxPython API Documentation — wxPython Phoenix 4.2.2 documentation
"SetColMinimalWidth(self, col, width)"
- Josiah
···
Paul McNett <p@ulmcnett.com> wrote:
Rich Shepard wrote:
> The one thing I could not get right was the set of arguments to pass to
> self.SetColMinimalWidth(). The wxWidgets book does not provide the
> arguments,
> and the column number and width (in pixels) are only 2 of the required 3.
> I've no idea what that third one is, so I set the minimum column width for
> each column. I hope that the wxPython book provides the answer to this!
Help on method SetColMinimalWidth in module wx.grid:
SetColMinimalWidth(*args, **kwargs) unbound wx.grid.Grid method
SetColMinimalWidth(self, int col, int width)
Wednesday, December 7, 2005, 3:43:54 PM, Rich Shepard wrote:
Thank you, all. I have it working just fine now. A key problem
(perhaps the major problem) was trying to put the wx.Grid on a
wx.Panel, then place that on the wx.Notebook page.
If the grid is the only child of your panel this should also work: