wxPyGridTableBase column size

Hi All,
A class of mine is inheriting from wxPyGridTableBase. I was wondering if there is a function/attribute of this class that can set the size/width of all columns without setting their value? what about individual columns?
Thanks

Not directly in the wxPyGridTableBase class. But you can use the
SetColSize(col) and GetColSize(col) method of the wxGrid class to set
resp. get the size of individual columns.

More details here <http://wiki.wxpython.org/index.cgi/wxGrid#head-912ba2d6c152a9d9e965b3352c9bc8125f6a0359>

/Jean Brouwers

···

On 8/30/05, Astan Chee stanc@al.com.au wrote:

Hi All,
A class of mine is inheriting from wxPyGridTableBase. I was wondering if
there is a function/attribute of this class that can set the size/width
of all columns without setting their value? what about individual columns?

Thanks


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Thanks Jean,

Also im currently experimenting with the demo.py script that comes with
the wxPython/wxWidgets.

Im looking at the wxGrid_MegaExample.py file which generates random
data and puts them on a wxPyGridTableBase.

In that inherited class, there is a function to sort the columns, I was
wondering if anyone has worked with this and can help me out doing a
sort and sub sort; that is to say, it ‘remembers’ if a previous sort
has been done (up to 1 ‘level’) and sorts itself accordingly. For
example…

a grid looks like this

X Y

···

1 a 5

2 c 4

3 a 3

4 a 2

5 a 1

Now if I sort the X colum, the result will be something like this:

X Y


1 a 5

3 a 3

4 a 2

5 a 1

2 c 4

and what Im trying to do is that if I sort the y column, the result is
something like this:

X Y


5 a 1

4 a 2

3 a 3

1 a 5

2 c 4

So it actually remembers to not swap the last 2 rows because a sort was
done previously.

Im wondering if this is too confusing/hard to understand/implement in
this class.

Thanks for the Help!

Jean Brouwers wrote:

Not directly in the wxPyGridTableBase class. But you can
use the
SetColSize(col) and GetColSize(col) method of the wxGrid class to set
resp. get the size of individual columns.

More details here <http://wiki.wxpython.org/index.cgi/wxGrid#head-912ba2d6c152a9d9e965b3352c9bc8125f6a0359>

/Jean Brouwers

On 8/30/05, Astan Chee stanc@al.com.au wrote:

Hi
All,

A class of mine is inheriting from wxPyGridTableBase. I was wondering if

there is a function/attribute of this class that can set the size/width

of all columns without setting their value? what about individual
columns?

Thanks


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hello,

Im newbie with Linux Ubuntu 5.04, I need this version of wxPython, in the repository only found 2.5.3, is too old, and my Boa/Spe IDEs need v 2.6.1

I tried compiled from source but its action fail. This is the error form my console:

…/…/…/./bk-deps g++ -c -o stcdll_XPM.o -D__WXGTK__ -I…/…/…/…/contrib/src/stc/…/…/include -I…/…/…/…/contrib/src/stc/scintilla/include -I…/…/…/…/contrib/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC -fPIC -DPIC -D__WXDEBUG__ -I…/…/…/lib/wx/include/gtk2-unicode-debug-2.6 -I…/…/…/…/include -DXTHREADS -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -I/usr/X11R6/include -O2 -pthread -I/usr/include/SDL -D_REENTRANT -Wall -Wno-ctor-dtor-privacy …/…/…/…/contrib/src/stc/scintilla/src/XPM.cxx

g++ -shared -fPIC -o …/…/…/lib/libwx_gtk2ud_stc-2.6.so.0.0.0 stcdll_PlatWX.o stcdll_ScintillaWX.o stcdll_stc.o stcdll_AutoComplete.o stcdll_CallTip.o stcdll_CellBuffer.o stcdll_ContractionState.o stcdll_Document.o stcdll_DocumentAccessor.o stcdll_Editor.o stcdll_ExternalLexer.o stcdll_Indicator.o stcdll_KeyMap.o stcdll_KeyWords.o stcdll_LexAPDL.o stcdll_LexAU3.o stcdll_LexAVE.o stcdll_LexAda.o stcdll_LexAsm.o stcdll_LexAsn1.o stcdll_LexBaan.o stcdll_LexBash.o stcdll_LexBullant.o stcdll_LexCLW.o stcdll_LexCPP.o stcdll_LexCSS.o stcdll_LexConf.o stcdll_LexCrontab.o stcdll_LexEScript.o stcdll_LexEiffel.o stcdll_LexErlang.o stcdll_LexForth.o stcdll_LexFortran.o stcdll_LexGui4Cli.o stcdll_LexHTML.o stcdll_LexKix.o stcdll_LexLisp.o stcdll_LexLout.o stcdll_LexLua.o stcdll_LexMMIXAL.o stcdll_LexMPT.o stcdll_LexMSSQL.o stcdll_LexMatlab.o stcdll_LexMetapost.o stcdll_LexNsis.o stcdll_LexOthers.o stcdll_LexPB.o stcdll_LexPOV.o stcdll_LexPS.o stcdll_LexPascal.o stcdll_LexPerl.o stcdll_LexPython.o stcdll_LexRuby.o stcdll_LexSQL.o stcdll_LexScriptol.o stcdll_LexSpecman.o stcdll_LexTeX.o stcdll_LexVB.o stcdll_LexVHDL.o stcdll_LexVerilog.o stcdll_LexYAML.o stcdll_LineMarker.o stcdll_PropSet.o stcdll_RESearch.o stcdll_ScintillaBase.o stcdll_Style.o stcdll_StyleContext.o stcdll_UniConversion.o stcdll_ViewStyle.o stcdll_WindowAccessor.o stcdll_XPM.o -pthread -L/usr/X11R6/lib -L…/…/…/lib -Wl,-soname,libwx_gtk2ud_stc-2.6.so.0 -lwx_gtk2ud-2.6 -lwxtiffd-2.6 -lwxjpegd-2.6 -lwxpngd-2.6 -lwxregexud-2.6 -pthread -L/usr/X11R6/lib -Wl,–version-script,…/…/…/version-script -lz -ldl -lm -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0 -lXinerama

(cd …/…/…/lib/; rm -f libwx_gtk2ud_stc-2.6.so libwx_gtk2ud_stc-2.6.so.0; ln -s libwx_gtk2ud_stc-2.6.so.0.0.0 libwx_gtk2ud_stc-2.6.so.0; ln -s libwx_gtk2ud_stc-2.6.so.0 libwx_gtk2ud_stc-2.6.so)

make: Leaving directory `/usr/src/rpm/BUILD/wxPython-src-2.6.1.0/bld/contrib/src/stc’

  • cd /usr/src/rpm/BUILD/wxPython-src-2.6.1.0/wxPython

  • /usr/bin/python2.4 setup.py WXPORT=gtk2 UNICODE=1 EP_ADD_OPTS=1 NO_SCRIPTS=1 ‘WX_CONFIG=/usr/src/rpm/BUILD/wxPython-src-2.6.1.0/bld/wx-config --no_rpath’ build_ext --rpath=/usr/lib/wxPython-2.6.1.0-gtk2-unicode/lib build

Preparing CORE…

Preparing GLCANVAS…

Preparing STC…

Preparing GIZMOS…

Preparing ANIMATE…

running build_ext

error: invalid Python installation: unable to open /usr/lib/python2.4/config/Makefile (Is a directory)

error: Bad exit status from /var/tmp/rpm-tmp.42016 (%build)

RPM build errors:

Bad exit status from /var/tmp/rpm-tmp.42016 (%build)

This is the command:

root@Laptop-Ubuntu:/home/mario/MisDownloads/Linux/Programas/wxPython # sudo rpmbuild --rebuild --define ‘pyver 2.4’ wxPython2.6-2.6.1.0-1.src.rpm

I follow the instructions form this website: http://www.bitpim.org/developer.html

Please any help?

Thanks in advance!!

Saludos / Best regards

Mario Lacunza Vásquez

Desarrollador de Sistemas - Webmaster

Celular : +51193100386 (Tim)

Website : http://www.lacunza.tk

Email : mlacunza@gmail.com

Blog : http://mlacunza.blogspot.com

Lima - Peru

The values of cells inside a grid table can be set to anything.
Since a grid with a grif table is virtual, in the subclass of
wxPyGridTableBase you must provide certain methods as callback methods
for wxPython to call.

The main ones are GetNumberCols(self), GetNumberRows(self),
GetValue(self, row, col), IsEmptyCell(self, row, col),
GetColLabelValue(self, col) and GetRowLabelValue(self, row). Here
is another example

<[http://mail.python.org/pipermail/python-list/2004-November/251652.html](http://mail.python.org/pipermail/python-list/2004-November/251652.html)>**.

Doing things like adding or deleting columns and rows is a little trickier, but there are example around for those too, like

<[http://wiki.wxpython.org/index.cgi/wxGrid#head-29b445f60c263fa3715196f0d85fdd05418f02c9](http://wiki.wxpython.org/index.cgi/wxGrid#head-29b445f60c263fa3715196f0d85fdd05418f02c9)>

HTH,

/Jean Brouwers

**) with this correction

<[http://mail.python.org/pipermail/python-list/2004-November/251679.html](http://mail.python.org/pipermail/python-list/2004-November/251679.html)>.
···

On 8/31/05, Astan Chee stanc@al.com.au wrote:

Thanks Jean,

Also im currently experimenting with the demo.py script that comes with
the wxPython/wxWidgets.

Im looking at the wxGrid_MegaExample.py file which generates random
data and puts them on a wxPyGridTableBase.

In that inherited class, there is a function to sort the columns, I was
wondering if anyone has worked with this and can help me out doing a
sort and sub sort; that is to say, it ‘remembers’ if a previous sort
has been done (up to 1 ‘level’) and sorts itself accordingly. For
example…

a grid looks like this

X Y


1 a 5

2 c 4

3 a 3

4 a 2

5 a 1

Now if I sort the X colum, the result will be something like this:

X Y


1 a 5

3 a 3

4 a 2

5 a 1

2 c 4

and what Im trying to do is that if I sort the y column, the result is
something like this:

X Y


5 a 1

4 a 2

3 a 3

1 a 5

2 c 4

So it actually remembers to not swap the last 2 rows because a sort was
done previously.

Im wondering if this is too confusing/hard to understand/implement in
this class.

Thanks for the Help!

Jean Brouwers wrote:

Not directly in the wxPyGridTableBase class. But you can
use the
SetColSize(col) and GetColSize(col) method of the wxGrid class to set
resp. get the size of individual columns.

More details here <http://wiki.wxpython.org/index.cgi/wxGrid#head-912ba2d6c152a9d9e965b3352c9bc8125f6a0359
>

/Jean Brouwers

On 8/30/05, Astan Chee stanc@al.com.au wrote:

Hi
All,

A class of mine is inheriting from wxPyGridTableBase. I was wondering if

there is a function/attribute of this class that can set the size/width

of all columns without setting their value? what about individual
columns?

Thanks


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Here is another example to add and delete columns and rows in a grid table from the wxPyGridTable subclass.

import wx, wx.grid as _wx_grid

class …GridTable(_wx_grid.PyGridTableBase):

def __init__(self, ...):
    _wx_grid.PyGridTableBase.__init__(self)
    ...

def AppendCol(self, num=1):
    '''Add one or more columns'''
    self._wx_msg_((_wx_grid.GRIDTABLE_NOTIFY_COLS_APPENDED, num),

(_wx_grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES,))

def AppendRow(self, num=1):
    '''Add one or more rows'''
    self._wx_msg_((_wx_grid.GRIDTABLE_NOTIFY_ROWS_APPENDED, num),

(_wx_grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES,))

def DeleteCol(self, col, num=1):
    '''Remove one or more columns starting at column col'''
    self._wx_msg_((_wx_grid.GRIDTABLE_NOTIFY_COLS_DELETED, col, num))

def DeleteRow(self, row, num=1):
    '''Remove one or more rows starting at row row'''
    self._wx_msg_((_wx_grid.GRIDTABLE_NOTIFY_ROWS_DELETED, row, num))

def _wx_msg_(self, *tups):

    '''Helper method to handle messages

       to the parent wxGrid instance, each

       argument is a message and each

       message is a tuple'''

    p = self.GetView()  # parent wxGrid

    if p and tups:

        p.BeginBatch()

        for t in tups:

m = _wx_grid.GridTableMessage(self, *t)

            p.ProcessTableMessage(m)

        p.EndBatch()
···

On 9/1/05, Jean Brouwers mrjean1@gmail.com wrote:

The values of cells inside a grid table can be set to anything.
Since a grid with a grif table is virtual, in the subclass of
wxPyGridTableBase you must provide certain methods as callback methods
for wxPython to call.

The main ones are GetNumberCols(self), GetNumberRows(self),
GetValue(self, row, col), IsEmptyCell(self, row, col),
GetColLabelValue(self, col) and GetRowLabelValue(self, row). Here
is another example

<[http://mail.python.org/pipermail/python-list/2004-November/251652.html

](http://mail.python.org/pipermail/python-list/2004-November/251652.html)>**.

Doing things like adding or deleting columns and rows is a little trickier, but there are example around for those too, like

<[http://wiki.wxpython.org/index.cgi/wxGrid#head-29b445f60c263fa3715196f0d85fdd05418f02c9

](http://wiki.wxpython.org/index.cgi/wxGrid#head-29b445f60c263fa3715196f0d85fdd05418f02c9)>

HTH,

/Jean Brouwers

**) with this correction

<[http://mail.python.org/pipermail/python-list/2004-November/251679.html

](recursion in __cmp__)>.

On 8/31/05, Astan Chee stanc@al.com.au wrote:

Thanks Jean,

Also im currently experimenting with the demo.py script that comes with
the wxPython/wxWidgets.

Im looking at the wxGrid_MegaExample.py file which generates random
data and puts them on a wxPyGridTableBase.

In that inherited class, there is a function to sort the columns, I was
wondering if anyone has worked with this and can help me out doing a
sort and sub sort; that is to say, it ‘remembers’ if a previous sort
has been done (up to 1 ‘level’) and sorts itself accordingly. For
example…

a grid looks like this

X Y


1 a 5

2 c 4

3 a 3

4 a 2

5 a 1

Now if I sort the X colum, the result will be something like this:

X Y


1 a 5

3 a 3

4 a 2

5 a 1

2 c 4

and what Im trying to do is that if I sort the y column, the result is
something like this:

X Y


5 a 1

4 a 2

3 a 3

1 a 5

2 c 4

So it actually remembers to not swap the last 2 rows because a sort was
done previously.

Im wondering if this is too confusing/hard to understand/implement in
this class.

Thanks for the Help!

Not directly in the wxPyGridTableBase class. But you can
use the
SetColSize(col) and GetColSize(col) method of the wxGrid class to set
resp. get the size of individual columns.

More details here <http://wiki.wxpython.org/index.cgi/wxGrid#head-912ba2d6c152a9d9e965b3352c9bc8125f6a0359
>

/Jean Brouwers

On 8/30/05, Astan Chee stanc@al.com.au wrote:

Hi
All,

A class of mine is inheriting from wxPyGridTableBase. I was wondering if

there is a function/attribute of this class that can set the size/width

of all columns without setting their value? what about individual
columns?

Thanks


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Jean Brouwers wrote: