Is this possible???

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Is this possible???

Post by 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

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Is this possible???

Post by Bitmonster » Mon Apr 14, 2008 3:53 pm

For all panel.Ctrls() the first parameter is the initial value.
http://www.eventghost.org/forum/viewtop ... 4211#p4211
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Is this possible???

Post by 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

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Is this possible???

Post by 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!

krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Is this possible???

Post by krambriw » Wed Apr 16, 2008 1:56 pm

Im not so clever in that :oops:
I tried the code above but...

Post Reply