Is this possible???

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Is this possible???

Postby krambriw » Mon Apr 14, 2008 12:54 pm

Hello,

I would like to do something like this:

Code: Select all
        for i in range(1, 3):
                label = "ai_"+str(i)+"_level"
                lb = "av_"+str(i)
                label = panel.SpinIntCtrl(lb, 0, 254)
                label.SetInitialSize((50,-1))
                panel.AddLine("Analog In_"+str(i)+" Value for event (0-254)", label)


When I try it I get the error message:

14:53:29 ValueError: NumCtrl requires numeric value, passed u'av_1'


Any help is very much appreciated,
Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Is this possible???

Postby Bitmonster » Mon Apr 14, 2008 3:53 pm

For all panel.Ctrls() the first parameter is the initial value.
viewtopic.php?p=4211#p4211
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Bitmonster
Site Admin
 
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Is this possible???

Postby krambriw » Mon Apr 14, 2008 4:07 pm

Thanks, yes in he case above the initial value would be 0.

But this was not my real Q, I asked if there is a way to create a range of controls using a for loop and where I use the increment (i) as part of the names.

Best regards, Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Is this possible???

Postby Bitmonster » Wed Apr 16, 2008 1:12 pm

Why don't you try? :)
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Bitmonster
Site Admin
 
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Is this possible???

Postby krambriw » Wed Apr 16, 2008 1:56 pm

Im not so clever in that :oops:
I tried the code above but...
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 1 guest