learningsizers1.py

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.

Hi David

···

2010/4/5 David Arnold <dwarnold45@suddenlink.net>:

Seems like the line "doctxt.SetLabel(MyPanel_0.__doc__)" causes this error:

MyPanel_0 contain no docstring, MyPanel_0.__doc__ returns None while
String or Unicode type are required. Add a docstring to MyPanel_0
object.

Martin Weberg

LearnSizers1 from the wiki is quite obsolete.
I can only recommend to use this version, which is - I think - more
user friendly.

http://spinecho.ze.cx/

Jean-Michel Fauth, Switzerland

···

On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

All,

I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

Be handy if the extensions were .pyw

···

On Apr 5, 1:19 pm, jmfauth <wxjmfa...@gmail.com> wrote:

On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

> All,

> I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

LearnSizers1 from the wiki is quite obsolete.
I can only recommend to use this version, which is - I think - more
user friendly.

http://spinecho.ze.cx/

Jean-Michel Fauth, Switzerland

Martin,

Perfect! Thanks.

David.

···

On Apr 5, 2010, at 1:04 AM, Martin Weberg wrote:

Hi David

2010/4/5 David Arnold <dwarnold45@suddenlink.net>:

Seems like the line "doctxt.SetLabel(MyPanel_0.__doc__)" causes this error:

MyPanel_0 contain no docstring, MyPanel_0.__doc__ returns None while
String or Unicode type are required. Add a docstring to MyPanel_0
object.

Martin Weberg

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Jean

Thanks.

David.

···

On Apr 5, 2010, at 5:19 AM, jmfauth wrote:

On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

All,

I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

LearnSizers1 from the wiki is quite obsolete.
I can only recommend to use this version, which is - I think - more
user friendly.

http://spinecho.ze.cx/

Jean-Michel Fauth, Switzerland

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Why not just update the Learn Sizers example with your new version?

···

On Apr 5, 7:19 am, jmfauth <wxjmfa...@gmail.com> wrote:

On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

> All,

> I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

LearnSizers1 from the wiki is quite obsolete.
I can only recommend to use this version, which is - I think - more
user friendly.

http://spinecho.ze.cx/

Jean-Michel Fauth, Switzerland

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

- Simply because I understand nothing in the "wiki" stuff and I'm
not registrated. (Should it be?)

- In the newest versions, the number of exemples has increased
and the new zip file is a collection of modules (no more a
single file).

- Due to my poor English, I do not like to spend time in blah, blah,
blah. (Not able to write so verbous, very informative and very nice
exemples as you do).

- I should be noticed, the first version was clean and ok. I has been
modified and put on the wiki by somebody else.

jmf

···

On 5 avr, 17:46, Mike Driscoll <kyoso...@gmail.com> wrote:

On Apr 5, 7:19 am, jmfauth <wxjmfa...@gmail.com> wrote:

> On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

> > All,

> > I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

> LearnSizers1 from the wiki is quite obsolete.
> I can only recommend to use this version, which is - I think - more
> user friendly.

>http://spinecho.ze.cx/

> Jean-Michel Fauth, Switzerland

Why not just update the Learn Sizers example with your new version?

Alright...well, I can put the new one on there for you and probably
explain it too. Would that be ok?

···

On Apr 5, 1:22 pm, jmfauth <wxjmfa...@gmail.com> wrote:

On 5 avr, 17:46, Mike Driscoll <kyoso...@gmail.com> wrote:

> On Apr 5, 7:19 am, jmfauth <wxjmfa...@gmail.com> wrote:

> > On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

> > > All,

> > > I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

> > LearnSizers1 from the wiki is quite obsolete.
> > I can only recommend to use this version, which is - I think - more
> > user friendly.

> >http://spinecho.ze.cx/

> > Jean-Michel Fauth, Switzerland

> Why not just update the Learn Sizers example with your new version?

- Simply because I understand nothing in the "wiki" stuff and I'm
not registrated. (Should it be?)

- In the newest versions, the number of exemples has increased
and the new zip file is a collection of modules (no more a
single file).

- Due to my poor English, I do not like to spend time in blah, blah,
blah. (Not able to write so verbous, very informative and very nice
exemples as you do).

- I should be noticed, the first version was clean and ok. I has been
modified and put on the wiki by somebody else.

jmf

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

HI,

I'm looking at MyPanel19 in the new WithBoxSizers.py, where the comments indicate there is a distinction between wx.GROW and wx.EXPAND when working with boxsizers, which I'm told is not the case. So this might need to be corrected in the source comments.

David.

···

On Apr 5, 2010, at 5:19 AM, jmfauth wrote:

On 5 avr, 08:57, David Arnold <dwarnol...@suddenlink.net> wrote:

All,

I am trying to work my way through the tutorial on: http://wiki.wxpython.org/LearnSizers1

LearnSizers1 from the wiki is quite obsolete.
I can only recommend to use this version, which is - I think - more
user friendly.

http://spinecho.ze.cx/

Jean-Michel Fauth, Switzerland

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

HI,

I'm looking at MyPanel19 in the new WithBoxSizers.py, where the comments indicate there is a distinction between wx.GROW and wx.EXPAND when working with boxsizers, which I'm told is not the case. So this might need to be corrected in the source comments.

David.

Yes, I have read this yesterday.

wx.GROW == wx.EXPAND == 8192

True

However, I'm not sure Robin's explanation is completely correct. If I
recall correctly (?),
there was a time where this was not the case. I remember, the problem
was especially
accute with wx.StaticLine's, from there this distinction between
wx.GROW and wx.EXPAND,
which solved the issue. (wx.StaticLine's were also a problem in
GridBagSizer).

Anyway, let's live with the present status. I have a version 10
sleeping on my HD and
for consistency I will drop any wx.GROW reference.

Vesion 10 was also quickly tested with wxPy2.9.nnnnnnnnnn.

Jean-Michel Fauth, Switzerland

···

On 7 avr, 07:33, David Arnold <dwarnol...@suddenlink.net> wrote: