472,330 Members | 1,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,330 software developers and data experts.

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 2015
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

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

Similar topics

1
by: chauhan | last post by:
Hi, I am new to pogramming. I have written a small program which retrieves emails from server, unless all the messages are loaded only then it...
3
by: Andre Loker | last post by:
Hi! For my current application I'm looking for a four-way-(cross) splitter control (as often seen in 3D-editors). The .NET Splitter-class is...
3
by: MFRASER | last post by:
How do I move the splitter inside of code. if(TypeA) { this.pnlHXMLList.Visible = false; this.splTop.is.Top = 65; } else
4
by: BBM | last post by:
I'm trying to set up a form with two panels divided by a Splitter control. I can make the Splitter work in the situations described in the...
4
by: Peter | last post by:
Hi, Does anyone know how to drag a splitter by coding. I will put three controls on form1,two panels and a splitter. The first panel's dock...
5
by: Sam | last post by:
Hi, I have a panel docked to the bottom of my form. This panel can be expanded vertically by clicking on a button. When the user click on the...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. ...
1
by: JDeats | last post by:
I have a simple WinForm with a WinForms splitter down the middle. I would like to make it so when the user clicks on a button inside the left...
1
by: JDeats | last post by:
I have a WinForm with three Splitter controls on it. The form divides up in this order: Tab Control (docked to the left): Splitter1: RichTextBox...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.