All,
I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1
I get this far, but then I run into trouble:
import os
import sys
import wx
class ColWin(wx.Window):
def __init__(self, parent, id, BackColour):
wx.Window.__init__(self, parent, id, (-1, -1), (-1, -1), wx.SIMPLE_BORDER)
self.SetBackgroundColour(BackColour)
class MyPanel_0(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize)
class TestComboBox(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
sampleList = []
for i in range(0, 26):
sampleList.append('MyPanel_' + `i`)
st=wx.StaticText(self,-1,"Select the example you want to see."
"Then click the view button.",(-1,-1))
doctxt=wx.StaticText(self,-1,"")
doctxt.SetLabel(MyPanel_0.__doc__)
class MyApp(wx.App):
def OnInit(self):
frame = wx.Frame(None, -1, __file__, (0, 0), (400, 300))
frame.panel = TestComboBox(frame, -1)
frame.Center()
frame.Show()
self.SetTopWindow(frame)
return True
def main():
app = MyApp(False)
app.MainLoop()
if __name__ == '__main__':
main()
Seems like the line "doctxt.SetLabel(MyPanel_0.__doc__)" causes this error:
Traceback (most recent call last):
File "/Users/darnold/Documents/Aptana Studio Workspace/zetcode/src/wxpython_tutorial/layout/learnsizers.py", line 44, in <module>
main()
File "/Users/darnold/Documents/Aptana Studio Workspace/zetcode/src/wxpython_tutorial/layout/learnsizers.py", line 40, in main
app = MyApp(False)
File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/wx/_core.py", line 7978, in __init__
self._BootstrapApp()
File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/wx/_core.py", line 7552, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "/Users/darnold/Documents/Aptana Studio Workspace/zetcode/src/wxpython_tutorial/layout/learnsizers.py", line 33, in OnInit
frame.panel = TestComboBox(frame, -1)
File "/Users/darnold/Documents/Aptana Studio Workspace/zetcode/src/wxpython_tutorial/layout/learnsizers.py", line 26, in __init__
doctxt.SetLabel(MyPanel_0.__doc__)
File "/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/wx/_core.py", line 8500, in SetLabel
return _core_.Window_SetLabel(*args, **kwargs)
TypeError: String or Unicode type required
Can anyone help me turn this around?
Also, again on: http://wiki.wxpython.org/LearnSizers1
It seems to me that lines 915-925 are not used for anything. I'm thinking just delete them. Comments?
David.