wxNotebook and wxGrid compatibility

This is a runnable sample that illustrates the issue - note that the first notebook page contains visible buttons, but the second page contains a strange greyed out header:

BEGIN CODE

#!/usr/bin/env python

import wx.grid
import sys
import wx

class EntryPage(wx.Panel):

def __init__(self, parent):
   
    wx.Panel.__init__(self, parent)

    testButton = wx.Button(self, -1, label = "test button", pos = (10,10))

class CustomDataTable(wx.grid.PyGridTableBase):
def init(self):
wx.grid.PyGridTableBase.init(self)
self.colLabels = [‘ID’, ‘text’]
self.dataTypes
= [wx.grid.GRID_VALUE_NUMBER,
wx.grid.GRID_VALUE_STRING]
self.data = [
[1, “one”],
[2, “two”],
[3, “three”]]

class GraphicsPage(wx.grid.Grid):

def __init__(self, parent):
    wx.grid.Grid.__init__(self, parent, -1)
    table = CustomDataTable()
    self.SetTable(table)
    self.SetRowLabelSize

(0)
self.SetMargins(0,0)
self.AutoSizeColumns(False)
self.ForceRefresh()

class MainFrame(wx.Frame):

def __init__(self, parent, id, title, pos=wx.DefaultPosition
···

,
size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):

    wx.Frame.__init__(self, parent, id, title, pos, size, style)
    self.SetBackgroundColour("GREY")
   
    panel = wx.Panel(self) # current this is the only panel defined
    notebook = wx.Notebook(panel)
   
    # create the page windows as children of the notebook
    page1 = EntryPage(notebook)

    notebook.AddPage(page1, "Expense Entry")
   
    page2 = GraphicsPage(notebook)
    notebook.AddPage(page2, "Graphics")
   
    sizer = wx.BoxSizer()
    sizer.Add(notebook, 1, wx.EXPAND)
    panel.SetSizer(sizer)

class Launcher(wx.App):

def OnInit(self):
   
    win = MainFrame(None, -1, "dan", style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE

)
win.Show(True)
self.SetTopWindow(win)

    return True

def Main(self):
   
    self.MainLoop()

MAIN

launcher = Launcher(redirect=False)

launcher.Main()

END CODE

On 4/24/07, Robin Dunn robin@alldunn.com wrote:

Daniel Sisco wrote:

The final result is that the first notebook page shows up fine - but the
grid page only shows a gray block for the upper header - no data or
header text. I think this might have something to do with my use of

wxBoxSizer?

Nothing in your code jumps out at me as wrong. Please make a small
runnable sample that shows the problem so we can duplicate it here.


Robin Dunn
Software Craftsman

http://wxPython.org
Java give you jitters? Relax with wxPython!


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