subclassing wx.grid

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

subclassing wx.grid

john fabiani`
Hi folks,

The question is how to correctly subclass the wx.grid.

In the past I used wx.grid.Grid as the super class.  If you look at a older version wxPython3 demo's they use it to along with other base classes i.e. PyGridTableBase.  None of that applies with wxPython4.  I'd like to see a little more code than just the wxPython 4 demo code - which is helpful but confusing.   So I'm hoping someone has used the new wxPython4 in a new project and figured out many of the in's and out's of the new grid code. 

Thanks in advance,
Johnf

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: subclassing wx.grid

Rich Shepard
On Mon, 30 Apr 2018, john fabiani` wrote:

> The question is how to correctly subclass the wx.grid. In the past I used
> wx.grid.Grid as the super class. If you look at a older version wxPython3
> demo's they use it to along with other base classes i.e. PyGridTableBase. 
> None of that applies with wxPython4. I'd like to see a little more code
> than just the wxPython 4 demo code - which is helpful but confusing. So
> I'm hoping someone has used the new wxPython4 in a new project and figured
> out many of the in's and out's of the new grid code.

   +1 I need to use wx.grid in my wxPython4 application and find it quite
confusing. I, too, want to better understand how to use it.

Rich

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: subclassing wx.grid

Dietmar Schwertberger-2
In reply to this post by john fabiani`
On 4/30/2018 9:24 PM, john fabiani` wrote:
In the past I used wx.grid.Grid as the super class.  If you look at a older version wxPython3 demo's they use it to along with other base classes i.e. PyGridTableBase.  None of that applies with wxPython4.  I'd like to see a little more code than just the wxPython 4 demo code - which is helpful but confusing.   So I'm hoping someone has used the new wxPython4 in a new project and figured out many of the in's and out's of the new grid code. 

What is wrong with the GridHugeTable.py demo? It shows how to use GridTableBase in case you want or need virtual tables.
Just derive from wx.grid.Grid and  wx.grid.GridTableBase instead of grid.PyGridTableBase.

For a grid which does not have a data table, but owns the data and formats, have a look at GridSimple.py


There were no fundamental changes between wxPython 3 and 4 except that you can derive directly instead of using Py... classes.


Regards,

Dietmar

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: subclassing wx.grid

john fabiani`

I have not found that to be correct.  It maybe that I have created an error in my code and don't see it but I will give it the college try again before I post any code.


Johnf


On 04/30/2018 02:17 PM, Dietmar Schwertberger wrote:
On 4/30/2018 9:24 PM, john fabiani` wrote:
In the past I used wx.grid.Grid as the super class.  If you look at a older version wxPython3 demo's they use it to along with other base classes i.e. PyGridTableBase.  None of that applies with wxPython4.  I'd like to see a little more code than just the wxPython 4 demo code - which is helpful but confusing.   So I'm hoping someone has used the new wxPython4 in a new project and figured out many of the in's and out's of the new grid code. 

What is wrong with the GridHugeTable.py demo? It shows how to use GridTableBase in case you want or need virtual tables.
Just derive from wx.grid.Grid and  wx.grid.GridTableBase instead of grid.PyGridTableBase.

For a grid which does not have a data table, but owns the data and formats, have a look at GridSimple.py


There were no fundamental changes between wxPython 3 and 4 except that you can derive directly instead of using Py... classes.


Regards,

Dietmar

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: subclassing wx.grid

Dietmar Schwertberger-2
On 5/1/2018 12:02 AM, john fabiani` wrote:

I have not found that to be correct.  It maybe that I have created an error in my code and don't see it but I will give it the college try again before I post any code.

Do you get core dumps?
When I ported my code to one of the first Phoenix versions two years ago, I got some. They were related to GetAttr/GridCellAttr. Phonix was less tolerant here. Always be sure to keep a reference to your GridCellAttr instances and call attr.IncRef() before it gets returned by GetAttr.

Regards,

Dietmar

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.