How to update window after wxGrid is updated?
Tim Williams
timothy.williams at nvl.army.mil
Fri May 14 22:02:08 EDT 2004
Brian Kelley <bkelley at wi.mit.edu> wrote in message news:<40a11859$0$560$b45e6eb0 at senator-bedfellow.mit.edu>...
> Tim Williams wrote:
> > Hi.
> >
> > I'm starting to learn wxPython and for an exercise I'm writing a
> > simple CSV file viewer. I just read in the CSV file and create a
> > wx.Grid with the data. I'm using Python 2.3.2 with wxPython 2.4.2.4.
> >
> > Everything runs fine under linux, but when I try the same code on a
> > Win XP machine, I have a window, but the frame the grid is in isn't
> > seen until I do a minimize/maximize on the window. Besides that, it
> > seems to run fine. I tried to do a self.Refresh(True,
> > self.grid.GetRect()), but that didn't help.
>
> Annoying isn't it? There are probably many solutions to this problem,
> but the one that I use is:
>
> > self.grid.AutoSizeColumns(True)
> > #self.Refresh(True, self.grid.GetRect())
> self.twiddle()
>
> def twiddle(self):
> x,y = self.GetSize()
> self.SetSize((x, y+1))
> self.SetSize((x,y))
>
> This forces a repaint of the window and will also add scroll bars if
> necessary. You are welcome to join us on the wxpython user list as well
> for more in-depth answers.
>
> You have an unrelated bug in your code as well:
>
> for i in len(row):
>
> should be
> for i in range(len(row)):
>
>
> Brian
Thanks. I caught this bug after I posted. I've been in a class the
last 3 days. When I get back on Monday, I'll try out your answer and
the other poster's one.
More information about the Python-list
mailing list