wxGrid difficulty

Cliff Wells LogiplexSoftware at earthlink.net
Tue Jan 14 16:02:53 EST 2003


On Tue, 2003-01-14 at 12:35, mail at trewornan.fsnet.co.uk wrote:
> Using Python version 2.2.2 and wxPython version 2.3.4.2 I'm trying to write
> a basic grid class as a component for a larger system. The grid doesn't seem
> to be appearing as I was expecting I just get a grey square in one corner
> and the rest of the frame blank.
> 
> I've spent hours on this trying different changes in the code and comparing
> it with the code in the wxPython demo but I can't work out what the problem
> is. I don't think I'm going to solve this on my own - anybody see what the
> problem is?
> 
> 
> from wxPython.wx import *
> from wxPython.grid import *
> 
> class Chart(wxGrid):
#     def OnInit(self, parent):
      def __init__(self, parent, id):
>         wxGrid.__init__(self, parent, -1)
>         self.CreateGrid(25,25)
> 
> class MyApp(wxApp):
>     def OnInit(self):
>         frame = wxFrame(NULL, -1, "PMSChart")
>         grid = Chart(frame, -1)
>         frame.Show(true)
>         self.SetTopWindow(frame)
>         return true
> 
> if __name__ == "__main__":
>     app = MyApp()
>     app.MainLoop()

You need an __init__ method in your Chart class (see my modification
above).  OnInit() is used only in wxApp.

BTW, your wxPython questions will be answered quicker on the
wxPython-users mailing list:

http://www.wxpython.org/maillist.php


Regards,

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308






More information about the Python-list mailing list