Dynamic Object Assignments

Ya, the list is my fault. I'm trying to create a button(or textctrl)
with the name b1 and then if there is another button in the list assign
it the name b2. The 'b' part is given, then the bindex is supposed to
be added to the 'b' part.

So partially, this is my newbie understanding of python. I see that %s
w/out quotes is probably an issue in this case, thanks Bill. What do
you think about what I'm trying to do now?

Thank you,

bill.mill@gmail.com 11/02/04 06:22:04 PM >>>

Keith,

I have a bunch of questions for you.

First off, why do you have the elements of the list inside
parentheses? They should not be, it seems to me.

Second off, the exact error you're getting is just what it says:
you're trying to assign a value to an operator. What do you intend the
line "b%s = wx.Button(self,-1,'') % bindex" to do? It doesn't mean
anything in Python.

b%s means "b mod s" which means, "the remainder of b divided by s".
This statement should never be on the left side of an assignment,
since you can't assign a value to the result of a mod operation.

Peace
Bill Mill
bill.mill at gmail.com

I am trying to create wx objects dynamically, for example:

List = [(button),(textctrl),(button),(checkbox)]

bindex,tindex,cindex = 1

for item in List:
    if item == 'button':
        b%s = wx.Button(self,-1,'') % bindex
        bindex += 1

    elif item == 'textctrl':
        t%s = wx.TextCtrl(self,-1,'') % tindex
        tindex += 1

    else:
        c%s = wx.CheckBox(self,-1) % cindex
        cindex += 1

I get "SyntaxError: can't assign to operator". Maybe you know what

I'm

ยทยทยท

On Tue, 02 Nov 2004 17:39:20 -0800, Keith Bolton <keith.bolton@batescapital.com> wrote:

trying to do is possible, thanks for any hints.

Keith Bolton

---------------------------------------------------------------------

To unsubscribe, e-mail:

wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail:

wxPython-users-help@lists.wxwidgets.org

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org