Hello Schooner30,

thanks for your reply. I had a look at it too today and came up with 
with this working code:

         n=0
         for c in choices:
             b=Radiobutton(self,f, text=str(c),variable=self.v, 
value=pow(2,n))
             b.pack()
             c_halpin=halpin+"."+str(c)
             pycomp.newpin(c_halpin, HAL_BIT, HAL_OUT)
             self.halpins.append(c_halpin)
             if n==initval:
                 b.select()
                 pycomp[self.halpins[-1]]=1
             n+=1

But I like your solution better, because your:
pycomp[self.halpins[initval]]=1
is more readable than my:
pycomp[self.halpins[-1]]=1

So please do submit your patch.

@cradek:
Since Schonner30 has a better/more readable fix I will not persue this 
with my own patch anymore. But thank you for your informations on how to 
submit a patch anyway on the irc channel.

BR
Max.

> Further to below
>
> If you want an immediate fix
>
> /usr/share/pyshared/pyvcp_widgets.py
> line 617
> below
> self.selected = initval
>
> insert
> pycomp[self.halpins[initval]]=1
>
> at same indentation
>
> That will force an update of the initval selected pin or defaults
> setting pin 0 if initval is not set, which is the default radio button
> setting at initialisation
>
> regards
>
>
>
>  >Hi
>
>  >I have tested your code on 2.6.3, 2.7 and 2.8
>  >All of them produce a pyVCP panel with button 3 selected
>
>  >But no, the respective pin is not selected, I think I may know why.
>
>  >When I made a lot of alterations a while back to pyVCP, I changed the
>  >update code, so that it did not keep cycling through updates every
>  >call unless there was a change.
>  >This will have suppressed the first update.
>
>  >I expect no-one has noticed until now, because the initval will
>  >generally reflect the default setting rather than actually set it.
>  >Thereafter all clicks upon radio buttons will work as anticipated
>
>  >I have written a fix,  which seems to work OK.
>  >Will do a bit more testing and submit a patch to correct this
>
>  >regards

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to