> -----Original Message-----
> From: Geoff Skerrett [mailto:Geoff teammsa.com]
> Sent: Monday, November 05, 2007 4:48 PM
> To: wxPython-users lists.wxwidgets.org
> Subject: RE: [wxPython-users] Updating a wx.Grid from
SQL Server
>
> > -----Original Message-----
> > From: Mike Driscoll [mailto:mdriscoll co.marshall.ia.us]
> > Sent: Monday, November 05, 2007 6:32 PM
> > To: wxPython-users lists.wxwidgets.org
> > Subject: [wxPython-users] Updating a wx.Grid from
SQL Server
> >
> > Hi,
> >
> > I have a wx.Grid object that is displaying a
user's hours per pay
> > period by accessing data stored in SQL Server.
What I would
> like to be
> > able to do is allow the user to click some buttons
labeled Next and
> > Prev to go to the next or previous pay period and
display
> those hours.
> > Unfortunately, the number of rows change between
pay period
> for this
> > particular type of user and I cannot get the grid
to change
> > accordingly.
> >
> > If I create the entire frame from scratch, it
works great.
> > But I would like to just update the grid object. I
tried destroying
> > the grid and then recreating it, but the grid
doesn't seem to get
> > re-added to my sizer, so it's "smushed"
> > up in the corner of the frame. How do I re-add it
to the
> sizer at the
> > correct place? Is there a better way then
destroying it?
> >
> > I'm using wxPython 2.8, Python 2.4 and Windows XP
Pro.
> >
> I think the solution is to a single grid object, but
with a
> virtual table.
> When the period changes, you create a new table and
then
> "set" the grid to the new table.
>
> Check out the Grid_MegaExample in the demo for an
example.
>
> G.
>
This does indeed seem to be one way to do it. Unfortunately,
this code is
above my head. I've been reading and re-reading it for about
an hour and I
just don't get it. Also, the wiki muddies things up a bit
since it
suggests both virtual tables in one place and
deleting/recreating the
grid's parent widget in another:
http://wiki
.wxpython.org/UpdatingGridData or
http://wiki.wxpython.
org/wxGrid
http://wi
ki.wxpython.org/AppendingGridTable
Oh well. Thanks for the tip.
Mike
------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribe lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help lists.wxwidgets.org
|