469,117 Members | 1,366 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,117 developers. It's quick & easy.

trouble stealing wx.splitter code

I am trying to steal this code from the wxpython demo but it appears that mb comes from nowhere and I am having errors because of it

Expand|Select|Wrap|Line Numbers
  1. import  wx
  2.  
  3. #---------------------------------------------------------------------------
  4.  
  5. class MySplitter(wx.SplitterWindow):
  6.     def __init__(self, parent, ID, log):
  7.         wx.SplitterWindow.__init__(self, parent, ID,
  8.                                    style = wx.SP_LIVE_UPDATE
  9.                                    )
  10.         self.log = log
  11.  
  12.         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
  13.         self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
  14.  
  15.     def OnSashChanged(self, evt):
  16.         self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
  17.  
  18.     def OnSashChanging(self, evt):
  19.         self.log.WriteText("sash changing to %s\n" % str(evt.GetSashPosition()))
  20.         # uncomment this to not allow the change
  21.         #evt.SetSashPosition(-1)
  22.  
  23.  
  24. #---------------------------------------------------------------------------
  25.  
  26. def runTest(frame, nb, log):
  27.     splitter = MySplitter(nb, -1, log)
  28.  
  29.     #sty = wx.BORDER_NONE
  30.     #sty = wx.BORDER_SIMPLE
  31.     sty = wx.BORDER_SUNKE
  32.  
  33.     p1 = wx.Window(splitter, style=sty)
  34.     p1.SetBackgroundColour("pink")
  35.     wx.StaticText(p1, -1, "Panel One", (5,5))
  36.  
  37.     p2 = wx.Window(splitter, style=sty)
  38.     p2.SetBackgroundColour("sky blue")
  39.     wx.StaticText(p2, -1, "Panel Two", (5,5))
  40.  
  41.     splitter.SetMinimumPaneSize(20)
  42.     splitter.SplitVertically(p1, p2, -100)
  43.  
  44.     return splitter
  45.  
  46.  
  47. #---------------------------------------------------------------------------
  48.  
  49.  
  50. overview = """\
  51. This class manages up to two subwindows. The current view can be split
  52. into two programmatically (perhaps from a menu command), and unsplit
  53. either programmatically or via the wx.SplitterWindow user interface.
  54. """
  55.  
  56. if __name__ == '__main__':
  57.     import sys,os
  58.     import run
  59.     run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
  60.  
File "C:\Python25\wx-2.6-msw-ansi\wx\_windows.py", line 1013, in __init__
newobj = _windows_.new_SplitterWindow(*args, **kwargs)
TypeError: argument number 1: a 'wxWindow *' is expected, 'int(-1)' is received
Dec 7 '06 #1
2 1873
to extend and revise it is in the run test code. When I try to cut and paste this where would I get the value from??
Dec 7 '06 #2
Here is what I was wanting to split in two (I don't know that I need a splitter but I have buttons that go one under the other and when I change that I get wierd glitches)

Expand|Select|Wrap|Line Numbers
  1. ):
  2.  
  3.         wx.Frame.__init__(self, parent, -1, "Dex Tracker Score Editor", size=(640,480))
  4.         p = wx.Panel(self, -1, style=0)
  5.         self.grid = WordGrid(p, log)
  6.         b = wx.Button(p, -1, "Save Grid")            #b gets numbered per button and then description set
  7.         b2 = wx.Button(p, 100, "Add Line")
  8.         b3 = wx.Button(p, -1, "Insert Line")
  9.         b4 = wx.Button(p, -1, "Delete Line")
  10.         b5 = wx.Button(p, -1, "Play from line to line")
  11.  
  12.         b.SetDefault()
  13.         self.Bind(wx.EVT_BUTTON, self.OnButton, b)    #bind to the button I am numbering them
  14.         self.Bind(wx.EVT_BUTTON, self.OnButton2, b2)
  15.         self.Bind(wx.EVT_BUTTON, self.OnButton3, b3)
  16.         self.Bind(wx.EVT_BUTTON, self.OnButton4, b4)
  17.         self.Bind(wx.EVT_BUTTON, self.OnButton5, b5)
  18.         b.Bind(wx.EVT_SET_FOCUS, self.OnButtonFocus)  #bind button focus if needed
  19.         #bs = wx.BoxSizer(wx.ALIGN_BOTTOM)
  20.         #bs = wx.StaticBoxSizer(wx.
  21.         bs = wx.BoxSizer(wx.HORIZONTAL)#(wx.VERTICAL)#|wx.ALIGN_BOTTOM)   #(wx.HORIZONTAL_HATCH)   #(wx.VERTICAL)
  22.         #bs.Add(self.grid, 1, wx.GROW|wx.ALL, 5)
  23.         bs.Add(b)                                     #add the button here numbered in par
  24.         bs.Add(b2)
  25.         bs.Add(b3)
  26.         bs.Add(b4)
  27.         bs.Add(b5)
  28.         #p.placed
  29.         bs = wx.BoxSizer(wx.VERTICAL)
  30.         bs.Add(self.grid, 1, wx.GROW|wx.ALL, 5)
  31.         p.SetSizer(bs)
  32.  
  33.  
Dec 7 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by chauhan | last post: by
3 posts views Thread by Andre Loker | last post: by
3 posts views Thread by MFRASER | last post: by
4 posts views Thread by Peter | last post: by
5 posts views Thread by Sam | last post: by
14 posts views Thread by aroraamit81 | last post: by
1 post views Thread by JDeats | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.