Help with python error - TypeError: String or unicode type required

Tanay Shah <[email protected]> Wed, 18 Mar 2009 15:37:22 +0530
Newsgroups gmane.comp.ide.boa-constructor.user
Message-ID <[email protected]>
PFA the code for a dialog in wxpython and kindly help me with the above
error, i.e., TypeError: String or Unicode type required

Another dialog with a pretty similar code works fine. Cannot figure out the
problem here.

Thanks in advance

-- 
Regards
Tanay Shah

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

_______________________________________________
Boa-constructor-users mailing list
Boa-constructor-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/boa-constructor-users
Dialog2.py (application/octet-stream, 6 KB)
#Boa:Dialog:Dialog2

import wx

def create(parent):
    return Dialog2(parent)

[wxID_DIALOG2, wxID_DIALOG2CLOSE, wxID_DIALOG2H, wxID_DIALOG2HRS, 
 wxID_DIALOG2M, wxID_DIALOG2MINS, wxID_DIALOG2NUMBER, wxID_DIALOG2S, 
 wxID_DIALOG2SCH, wxID_DIALOG2SECS, wxID_DIALOG2SETDATE, wxID_DIALOG2STNUMBER, 
 wxID_DIALOG2STSETDATE, wxID_DIALOG2STSETTIME, wxID_DIALOG2STTEXT, 
 wxID_DIALOG2TEXT, 
] = [wx.NewId() for _init_ctrls in range(16)]

class Dialog2(wx.Dialog):
    def _init_coll_fgsButtons_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.sch, 0, border=10, flag=wx.ALL)
        parent.AddWindow(self.close, 0, border=10, flag=wx.ALL)

    def _init_coll_boxSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.stNumber, 0, border=5, flag=wx.ALL)
        parent.AddWindow(self.Number, 0, border=5, flag=wx.ALL)
        parent.AddWindow(self.stText, 0, border=5, flag=wx.ALL)
        parent.AddWindow(self.Text, 0, border=5, flag=wx.EXPAND | wx.ALL)
        parent.AddWindow(self.stSetDate, 0, border=5, flag=wx.ALL)
        parent.AddWindow(self.SetDate, 0, border=5, flag=wx.ALL)
        parent.AddWindow(self.stSetTime, 0, border=5, flag=wx.ALL)
        parent.AddSizer(self.fgsTimePicker, 0, border=0, flag=0)
        parent.AddSizer(self.fgsButtons, 0, border=0, flag=0)

    def _init_coll_fgsTimePicker_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.h, 0, border=2, flag=wx.ALL)
        parent.AddWindow(self.hrs, 0, border=2, flag=wx.ALL)
        parent.AddWindow(self.m, 0, border=2, flag=wx.ALL)
        parent.AddWindow(self.mins, 0, border=2, flag=wx.ALL)
        parent.AddWindow(self.S, 0, border=2, flag=wx.ALL)
        parent.AddWindow(self.secs, 0, border=2, flag=wx.ALL)

    def _init_sizers(self):
        # generated method, don't edit
        self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

        self.fgsTimePicker = wx.FlexGridSizer(cols=0, hgap=0, rows=1, vgap=0)

        self.fgsButtons = wx.FlexGridSizer(cols=0, hgap=0, rows=1, vgap=0)

        self._init_coll_boxSizer1_Items(self.boxSizer1)
        self._init_coll_fgsTimePicker_Items(self.fgsTimePicker)
        self._init_coll_fgsButtons_Items(self.fgsButtons)

        self.SetSizer(self.boxSizer1)

    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Dialog.__init__(self, id=wxID_DIALOG2, name='', parent=prnt,
              pos=wx.Point(564, 248), size=wx.Size(206, 419),
              style=wx.DEFAULT_DIALOG_STYLE, title='Dialog2')
        self.SetClientSize(wx.Size(198, 385))

        self.stNumber = wx.StaticText(id=wxID_DIALOG2STNUMBER, label=u'Number',
              name=u'stNumber', parent=self, pos=wx.Point(5, 5),
              size=wx.Size(37, 16), style=0)

        self.Number = wx.TextCtrl(id=wxID_DIALOG2NUMBER, name=u'Number',
              parent=self, pos=wx.Point(5, 31), size=wx.Size(100, 21), style=0,
              value=u'')

        self.stText = wx.StaticText(id=wxID_DIALOG2STTEXT, label=u'SMS Text',
              name=u'stText', parent=self, pos=wx.Point(5, 62), size=wx.Size(45,
              13), style=0)

        self.Text = wx.TextCtrl(id=wxID_DIALOG2TEXT, name=u'Text', parent=self,
              pos=wx.Point(5, 85), size=wx.Size(188, 147),
              style=wx.TE_LINEWRAP | wx.TE_MULTILINE, value=u'')

        self.stSetDate = wx.StaticText(id=wxID_DIALOG2STSETDATE,
              label=u'Select Date', name=u'stSetDate', parent=self,
              pos=wx.Point(5, 242), size=wx.Size(54, 13), style=0)

        self.SetDate = wx.DatePickerCtrl(id=wxID_DIALOG2SETDATE,
              name=u'SetDate', parent=self, pos=wx.Point(5, 265),
              size=wx.Size(90, 21), style=wx.DP_SHOWCENTURY)

        self.stSetTime = wx.StaticText(id=wxID_DIALOG2STSETTIME,
              label=u'Select Time', name=u'stSetTime', parent=self,
              pos=wx.Point(5, 296), size=wx.Size(54, 13), style=0)

        self.h = wx.StaticText(id=wxID_DIALOG2H, label=u'H', name=u'h',
              parent=self, pos=wx.Point(2, 316), size=wx.Size(6, 13), style=0)

        self.hrs = wx.Choice(choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
              13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], id=wxID_DIALOG2HRS,
              name=u'hrs', parent=self, pos=wx.Point(12,316), size=wx.Size(44,
              21), style=0)

        self.m = wx.StaticText(id=wxID_DIALOG2M, label=u'M', name=u'm',
              parent=self, pos=wx.Point(60, 316), size=wx.Size(8, 13), style=0)

        self.mins = wx.Choice(choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
              13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
              29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
              45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],
              id=wxID_DIALOG2MINS, name=u'mins', parent=self, pos=wx.Point(72,
              316), size=wx.Size(48, 21), style=0)

        self.S = wx.StaticText(id=wxID_DIALOG2S, label=u'S', name=u'S',
              parent=self, pos=wx.Point(124, 316), size=wx.Size(12, 13),
              style=0)

        self.secs = wx.Choice(choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
              13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
              29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
              45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60],
              id=wxID_DIALOG2SECS, name=u'secs', parent=self, pos=wx.Point(140,
              316), size=wx.Size(52, 21), style=0)

        self.sch = wx.Button(id=wxID_DIALOG2SCH, label=u'Schedule', name=u'sch',
              parent=self, pos=wx.Point(10, 349), size=wx.Size(75, 23),
              style=0)

        self.close = wx.Button(id=wx.ID_CLOSE, label=u'', name=u'close',
              parent=self, pos=wx.Point(105, 349), size=wx.Size(75, 23),
              style=0)

        self._init_sizers()

    def __init__(self, parent):
        self._init_ctrls(parent)