wx.lib.multisash fails

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

wx.lib.multisash fails

sebastian lópez
Hi

i'm trying to use a multisash control but when I type some
values in the child control the others subcontrols don´t change

why?

platform windows 7
wx version 2.9.4.0
python version 2.7.2


Example code,

<d>
import  wx
import  wx.lib.multisash    as  sash
import  wx.grid             as  gridlib

class MyGrid(gridlib.Grid):
    def __init__(self, parent):
        gridlib.Grid.__init__(self, parent, -1, style=wx.NO_BORDER)
        self.CreateGrid(15,5)

class MyFrame(wx.Frame):
  def __init__(self, parent, ID, title):
    wx.Frame.__init__(self, parent, ID, title,
      wx.DefaultPosition, wx.Size(200, 150))
    multi = sash.MultiSash(self, -1, pos = (0,0), size = (640,480))
    multi.SetDefaultChildClass(MyGrid)
   
class MyApp(wx.App):
  def OnInit(self):
    frame = MyFrame(None, -1, "Multisash test")
    frame.Show(True)
    self.SetTopWindow(frame)
    return True

app = MyApp(0)
app.MainLoop()

</d>

I also add an screen shot of the trouble.




Note: the source code was taken from

http://wxpython-users.1045709.n5.nabble.com/Multisash-questions-td2321927.html

Best regards
--
Sebastián López
Ingeniero Químico


--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en
Reply | Threaded
Open this post in threaded view
|

Re: wx.lib.multisash fails

Robin Dunn
On 8/13/12 1:58 PM, sebastián wrote:
> Hi
>
> i'm trying to use a multisash control but when I type some
> values in the child control the others subcontrols don´t change
>
> why?

Because each grid has its own table, IOW its own copy of a 15x5 array of
data values.  If you want them to display the same data then you'll need
to implement your own table class derived from GridTableBase and assign
the same instance of that class to each grid.  Note that the Gird class
will not take care of telling the other grids sharing the same table to
update themselves when a value is changed in one of them, so you will
have to do that too.  Since you are using 2.9 you may want to look at
using the DataView classes instead since they are designed from the
beginning to have multiple views sharing the same model at the same time.


--
Robin Dunn
Software Craftsman
http://wxPython.org

--
To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wxPython-users?hl=en